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 the 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 the trusted list. If “Use Client IP in Header” is set to “Yes” instead of “Trusted IP only”, clients can spoof IPs with the “X-Forwarded-For” header sent to CloudFlare. As a result, this is not recommended.

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

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

the list of cloudflare IP subnet is available at Your litespeed configuration ACL allowed configuration should looks like


If there is another layer of proxy setup in front of LiteSpeed Web Server on the same server box, such as CloudFlare Railgun, Nginx, or Varnish, you also need to add that server IP to the trusted list.

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 installations).

litespeed_wiki/config/show-real-ip-behind-cloudflare.txt · Last modified: 2017/02/06 16:37 by George Wang