Show Real Visitor IP 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, navigate to LiteSpeed WebAdmin Console > Configuration > General Settings and set Use Client IP in Header to Trusted IP Only, and add CloudFlare IPs/Subnets to the trusted list, as shown below. 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 that is sent to CloudFlare. This is not recommended!

As of LSWS v5.4.9, CloudFlare IPs are automatically treated as trusted IPs, though they are not explicitly listed in the LiteSpeed ACL allowed configuration.

If, for some reason, you have a need to manually add CloudFlare IPs or other proxy/CDN IPs manually, the following shows how to do it. Please also refer to this wiki for detailed instructions.

The list of CloudFlare IP subnets is available at Your LiteSpeed ACL allowed configuration should look like:


If there is another layer of proxy setup in front of LiteSpeed Web Server on the same server box (i.e. CloudFlare Railgun, Nginx, or Varnish), you also need to add that server IP to the trusted list. QUIC.Cloud IPs and localhost should be automatically treated as Trusted IP already without any extra manual configuration.

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

Please be aware that only the access log shows real visitor IPs. The error log still shows IPs of CloudFlare nodes. This may change in a future release.

  • Admin
  • Last modified: 2021/11/11 16:28
  • by Lisa Clarke