How to enable remoteip Apache module in MAMP Pro

Discussion for guides including MAMP official & unofficial documentation. User submitted guides can be moved here by moderators.
Post Reply
mampsupportmod
Site Admin
Posts: 163
Joined: Wed Jan 20, 2021 3:06 am

How to enable remoteip Apache module in MAMP Pro

Post by mampsupportmod »

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:
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.

Mamp Pro Remote Ip Apache
Mamp Pro Remote Ip Apache (89.9 KiB) Viewed 42958 times

2. Open httpd.conf template.

Mamp Pro Apache Httpd Conf
Mamp Pro Apache Httpd Conf (101.77 KiB) Viewed 42958 times

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)

Mamp Pro Apache Trusted Ip Proxy Address
Mamp Pro Apache Trusted Ip Proxy Address (133.05 KiB) Viewed 42958 times

5. Restart MAMP Pro (Apache).
MAMP Support Forums is an unofficial support forum covering MAMP & MAMP Pro solution stacks.
Post Reply