set_real_ip_from […my server ip…];
RPAFenable On
How can I make sure that Apache shows the end user’s IP?
You shouldn’t use ngx_http_realip_module for issues like this.
Just set X-Real-IP header to $remote_addr variable value
in your location section with ‘proxy_pass’ directive
(or ‘fastcgi_pass’ or whatever you use).
Your mod_rpaf config have already correctly set up to handle X-Real-IP
header
and consider it as the end user’s IP.
Also, you shouldn’t use the RPAFsethostname option turned ‘On’ unless
you
set X-Host header in the nginx config before passing request to backend.
Just turn it ‘Off’.
Also, you shouldn’t use the RPAFsethostname option
turned ‘On’ unless you
set X-Host header in the nginx config before
passing request to backend. Just turn it ‘Off’.
Thanks Alexander. But this does not work.
I commented all the “set_real_ip_from” in nginx config. Restarted nginx.
Now the “REMOTE_ADDR” in my php code inside Apache is just my server’s
IP. So the real IP is not being passed.
If I enable the “set_real_ip_from” inside nginx config, then my php code
sees the right REMOTE_ADDR. But the log messages inside Apache are wrong
even then…all from my own server IP.
I’ve got nginx proxying to a lighttpd server (hosted on a DroboPro FS),
and I’m using only the following four directives in the proxy location’s
stanza:
This seems to be all that’s necessary. The proxy target’s access log
shows the accessing client’s IP for each request, not the nginx server.
You’ve got a lot more stuff going on in your config, though, so I’m not
sure if this will be helpful to you or not. Maybe you could comment out
some directives and start with just the basics?
-Lee
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.