This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:config:show-real-ip-behind-a-proxy [2016/06/08 14:19]
Jackson Zhang
litespeed_wiki:config:show-real-ip-behind-a-proxy [2016/06/17 13:24] (current)
Jackson Zhang
Line 1: Line 1:
-===== How to restore ​real visitor IP instead of proxy(such as CloudFlare) IP? =====+===== Show real visitor IP addresses ​instead of proxy IPs =====
-Sometime you may configure CloudFlare CDN or other proxy in front of your web server, in this case, you may only see proxy IP instead of real visitor IPs+When using proxy in front of your web server, you may see proxy IP instead of real IP addresses of visitors
-How to restore real visitor IP instead ​of CloudFlare ​IP?+To restore real visitor ​IPs simply enable the [[https://​www.litespeedtech.com/​docs/​webserver/​config/​general#​useIpInProxyHeader|Use Client ​IP in Header]] option to "​Trusted ip only" in the General Settings section ​of the Configuration page in your LiteSpeed Web Admin Console and [[https://​www.litespeedtech.com/​docs/​webserver/​config/​security#​accessControl_allow|add proxy IPs to trusted ​IP list]]. Please refer to [[litespeed_wiki:​config:​show-real-ip-behind-cloudflare|similar setting on cloudflare]].
-Go to your LiteSpeed Web Admin Console, Enable the option [[https://​www.litespeedtech.com/​docs/​webserver/​config/​general#​useIpInProxyHeader|"​Use Client IP in Header"​]] in Configuration.+{{ :​litespeed_wiki:config:​cloudflare-visitor-ip.png?​nolink&​500 |}}
-Once enabledyour access logs will now show the correct ​IP addressesand even PHP's $_SERVER['​REMOTE_ADDR'​] variable will contain the client real IP address, instead of CloudFlare IP addresswhich in itself will resolve most problems ​you could hit when enabling CloudFlare on PHP-enabled web sites (like WordPress or vBulletin installs).+For examplea Citrix Netscaler device serves ​the original ​IP record. By setting it to use "​X-Forwarded-For"​which is standard header for that purpose, you should then see the visitors'​ original IPs
-Please also refer [[https://​support.cloudflare.com/​hc/​en-us/​articles/​200170676-How-do-I-restore-original-visitor-IP-with-a-LiteSpeed-server-|CloudFlare document]].  +You may also see gateway ​ip/proxy ip with some null requests. This is normal. After one request ​is served, the IP will be reset to the LB IP  ​before a new request arrives. When new request ​arrives ​with the "​x-Forwarded-For"​ header, it will be updated. For keep-alive ​connections, in between two requests, the LB IP will shown on the real time request list. 
- +
-The same is true for other proxy setup.  +
- +
-For example, Citrix Netscaler device servers the original IP record. You can customize it to use "​X-Forwarded-For",​ which is a standard header for that purpose. Then you should see the visitor original IPs.  +
- +
-You may also see gatewall ​ip/proxy ip with some null requests, which is normal. After one request served, before new request coming, the IP will be reset to the LB IP. When new request ​coming ​with "​x-Forwarded-For"​ header, it will be updated. For keep-alive ​connection, in between two requests, the LB IP will shown on the real time request list.  +
- +
-To avoid proxy IP being blocked by server security setting, you should [[https://​www.litespeedtech.com/​docs/​webserver/​config/​security#​accessControl_allow|add LB IP to trusted IP list]].+
  • Admin
  • Last modified: 2016/06/08 14:19
  • by Jackson Zhang