How to enable remoteip Apache module in MAMP Pro
Posted: Tue Aug 01, 2023 11:01 am
For services like Cloudflare, you may want to see actual IP addresses of clients hitting your sites in your Apache access logs (not cloudflare proxy IP's.) To do this, you need to enable remoteip Apache module and confgiure the trusted proxy addresses.
Per Apache:
1. In MAMP Pro, enable remoteip_module in Apache.
2. Open httpd.conf template.
3. Update your LogFormat log replacing %h with %a. (this will show client IP address of the request in log files) Example:
4. Configure your trust proxy addresses accordingly.
5. Restart MAMP Pro (Apache).
Per Apache:
This module is used to treat the useragent which initiated the request as the originating useragent as identified by httpd for the purposes of authorization and logging, even where that useragent is behind a load balancer, front end server, or proxy server.
1. In MAMP Pro, enable remoteip_module in Apache.
2. Open httpd.conf template.
3. Update your LogFormat log replacing %h with %a. (this will show client IP address of the request in log files) Example:
Code: Select all
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
4. Configure your trust proxy addresses accordingly.
Code: Select all
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 192.0.2.1 (example IP address)
RemoteIPTrustedProxy 192.0.2.2 (example IP address)
5. Restart MAMP Pro (Apache).