If you install HAProxy on your server, you will notice that the remote IP address in the logs and webapps will display the IP of the proxy and not the remote IP address of the client. You can set HAProxy to forward the client IP address to the web server via the “forwardfor” configuration. Once that is done, configure the web server to read the forwarding IP address header.
Make sure you have the following configuration for HAProxy: /etc/haproxy/haproxy.cfg
option http-server-close option forwardfor except 127.0.0.0/8
If you are using Lighttpd, there is a module called mod_extforward that you can set to forward the original IP address:
If you are using Apache, here are the instructions to preserve the remote IP address:
Install Apache Mod_Extract_Forwarded package: (you need to have the EPEL repository)
yum install mod_extract_forwarded
Replace the 127.0.0.1 with your proxy IP address (e.g. 192.168.50.50)