简体   繁体   中英

Can't get client IPs in mod_status from mod_remoteip

I have Nginx setup as a reverse proxy and it's passing IPs to Apache. For some reason mod_status wont recognise client IPs and instead shows my website IP as a client IP.

Here is my old Apache 2.2 mod_rpaf configuraton:

RPAFenable On
RPAFproxy_ips 127.0.0.1 website IP server IP
RPAFsethostname On 
RPAFheader X-Forwarded-For

New Apache 2.4 mod_remoteip configuration:

RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 website IP server IP

Is it about wrong mod_realip configuration or is it that Apache 2.4 isn't supposed to work like this?

Also logs weren't working correctly, but were fixed by changing the format from %h to %a.

Additional info: Nginx proxy configuration location / { proxy_pass http://www.domain.com:8080 ; include /usr/local/etc/nginx/proxy.conf; }

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Wrestled with something similar all morning. There is a known bug in mod_rpaf: https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-rpaf/+bug/930540

Here is what worked for me. In /etc/apache2/mods-available/rpaf.conf simply replace:

<IfModule mod_rpaf.c>

with:

<IfModule mod_rpaf-2.0.c>

(Credit: https://serverfault.com/questions/393207/mod-rpaf-problems-with-nginx-front-apache-back-end-after-ubuntu-upgrade )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM