NethServer and Proxy Server

All needed changes are on the target server, not on the proxy server.

Create the file /etc/httpd/conf.d/remoteip.conf with following content (192.168.1.1 is the proxy server IP):

RemoteIPHeader X-Forwarded-For
# For internal IPs
RemoteIPInternalProxy 192.168.1.1
# For external IPs
RemoteIPTrustedProxy 192.168.1.1

Edit /etc/httpd/conf/httpd.conf at line 196. I commented out the original line and copied it and changed %h to %a:

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

Restart httpd to apply changes:

systemctl restart httpd

It worked in my test but I don’t know if it causes other issues.

Source:

EDIT:

On the proxy server you should already have the correct client ip in /var/log/httpd/access_log.

5 Likes