I'm on Mac OS X, running Ubuntu in VirtualBox. Mac OS can be accessed in the local network with IP 192.168.0.100 and Ubuntu is 192.168.0.123 (it's using the "Bridged Adapter" option in VirtualBox networking settings).
In the Ubuntu installation I have nginx (port 80) working as a reverse proxy to Apache 2.4 (port 8081). This is working fine, and if I open the browser in Mac OS and point to 192.168.0.123 it opens the files served by Apache, through nginx.
The problem is, even though I have enabled the RPAF module, I'm getting unexpected values for server and remote IP addresses on Apache.
When accessing from a browser in Mac, the values I expect are:
SERVER_ADDR = 192.168.0.123 # Apache server IP, which is the Ubuntu IP
REMOTE_ADDR = 192.168.0.100 # The Mac OS X IP
But, if I set nginx to proxy_pass 192.168.0.123:8081
I get:
SERVER_ADDR = 192.168.0.123
REMOTE_ADDR = 198.168.0.123
Setting proxy_pass 127.0.0.1:8081
gives me the correct remote address (191.168.0.100), but 127.0.0.1 as the server address.
Any ideas on how to get the expected results?
(EDIT) I'm using the default RPAF settings:
<IfModule rpaf_module>
RPAF_Enable On
RPAF_ProxyIPs 127.0.0.1
RPAF_SetHostName On
RPAF_SetHTTPS On
RPAF_SetPort On
RPAF_ForbidIfNotProxy Off
</IfModule>
And these settings in nginx:
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Server-Address $server_addr;
proxy_set_header Host $host;
Best Answer
Apache would see the IP address
192.168.0.123
as the source and that needs to be added theRPAF_proxyips
directive, this tellsmod_rpaf
that its a known proxy.Quoting from http://www.stderr.net/apache/rpaf/