Skip to content

See real visitor IPs on your server

Once your DNS points to Edge Caching, visitors connect to Edge Caching, and Edge Caching connects to your server. Unless your server is told otherwise, every request seems to come from Edge Caching’s IP address: in your access logs, in PHP’s REMOTE_ADDR, in WordPress (comments, security plugins, order fraud checks) and in any firewall or rate limit on your server.

Edge Caching sends the real visitor’s address with each request, in the X-Forwarded-For header (holding exactly one address, the visitor’s) and in X-Real-IP. You tell your web server to use it, only for requests coming from Edge Caching.

Edge Caching runs on several servers, and each one connects to your server from its own IPv4 address. Trust all of them: a request can come from any of them.

Edge Caching server addresses
142.44.161.52
148.113.191.182
148.113.252.226

The examples below already list all three. If Edge Caching adds a server, its address is added here.

OpenLiteSpeed, including RunCloud servers. The same two settings as LiteSpeed Enterprise, either in its WebAdmin console (port 7080) or in /usr/local/lsws/conf/httpd_config.conf:

useIpInProxyHeader 2
accessControl {
allow ALL, 142.44.161.52T, 148.113.191.182T, 148.113.252.226T
}

2 means Trusted IP Only; the T after each address marks it as trusted. Then restart:

Terminal window
/usr/local/lsws/bin/lswsctrl restart

PHP and WordPress need nothing more: the web server now gives them the visitor’s address in REMOTE_ADDR. No plugin is needed.

Create a file named ip-check.php at the root of your site:

<?php echo $_SERVER['REMOTE_ADDR'];

Open https://your-domain/ip-check.php: it should show your own IP address (search “what is my IP” to compare), not one of Edge Caching’s. Reload it a few times: each time it may come through a different Edge Caching server. New lines in your access log should show visitors’ addresses too.

Then delete ip-check.php.

Your server’s own firewall (CSF/LFD, cPGuard, Imunify360, fail2ban…) and WAF rules now see real visitors, which makes their logs and decisions meaningful. Two things to keep in mind:

  • Allow Edge Caching’s addresses in that firewall (in CSF, for example, in csf.allow and csf.ignore). All your visitors arrive through them: if one were ever blocked, your site would be unreachable for every visitor sent through that server.
  • Blocking a visitor’s IP at the network level of your server doesn’t stop them: their requests come from Edge Caching’s addresses. Rules that answer at the web server level (a WAF returning 403, for example) still work. To block an address before it reaches your server at all, use the Firewall.