I use a Nginx as the reverse proxy. Here is the scenario.
The original server is Server A. The reverse proxy is Server B. Web users are browser the website through Server B.
The web log of Server A just received the IP address of server B. All users are shared one remote address. It is Server B.
To pass the real IP address of client to the Web server, or server A.
- Set up on Server B.
Let server B add the X-Forwarded-For header to the request. It is the real IP of users. - Set up on Server A.
Add following in to Nginx server blockset_real_ip_from IP_Address_of_Server_B; real_ip_header X-Forwarded-For;
One of my web site use CloudFlare service.
How do I restore original visitor IP with Nginx?
https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-
Nginx real IP module
http://nginx.org/en/docs/http/ngx_http_realip_module.html
Reverse Proxy
https://en.wikipedia.org/wiki/Reverse_proxy