This is an old revision of the document!


Show real visitor IP addresses instead of CloudFlare IPs

When using CloudFlare CDN in front of your LiteSpeed web server, you may see a proxy IP instead of real IP addresses of visitors.

To restore real visitor IPs simply set the 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 add CloudFlare IPs/Subnets to trusted list. If “Use Client IP in Header” is set to “Yes” instead of “Trusted IP only”, client can spoof IP with “X-Forwarded-For” header sent to CloudFlare, hence not recommended.

The following snapshot shows the “Use Client IP in Header”:

The following snapshot shows how to add CloudFlare to trusted list. Please refer this wiki for setup details.

Once enabled, your access logs will show the correct IP addresses and even PHP's $_SERVER['REMOTE_ADDR'] variable will contain your visitors' real IP addresses instead of a CloudFlare IP address. This will resolve most problems that might occur when enabling CloudFlare on PHP-enabled web sites (like WordPress or vBulletin installs).

Please also refer to CloudFlare documentationhere

  • Admin
  • Last modified: 2016/06/17 13:06
  • by Jackson Zhang