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.
1. Edge Caching’s addresses
Section titled “1. Edge Caching’s addresses”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.
2. Configure your web server
Section titled “2. Configure your web server”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:
/usr/local/lsws/bin/lswsctrl restartLiteSpeed Enterprise, as installed on cPanel servers. Open the LiteSpeed WebAdmin console (port 7080, or from WHM: LiteSpeed Web Server → LiteSpeed Configuration).
-
Go to Configuration → Server → General and set Use Client IP in Header to Trusted IP Only.
-
Go to Configuration → Server → Security → Access Control and edit the Allowed List. Keep
ALLand add each Edge Caching address followed by a capitalT, which marks it as trusted:ALL, 142.44.161.52T, 148.113.191.182T, 148.113.252.226T -
Save, then do a Graceful Restart.
With Apache’s mod_remoteip module (on cPanel servers running Apache, enable
it in WHM → EasyApache 4). Add to your server or virtual host
configuration:
RemoteIPHeader X-Forwarded-ForRemoteIPTrustedProxy 142.44.161.52 148.113.191.182 148.113.252.226So your access logs show it too, use %a (the client address) instead of
%h in your LogFormat, for example:
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedThen reload Apache (apachectl graceful, or systemctl reload apache2 /
httpd).
With nginx’s realip module (built into most packages). In the http
block, or in your site’s server block:
set_real_ip_from 142.44.161.52;set_real_ip_from 148.113.191.182;set_real_ip_from 148.113.252.226;real_ip_header X-Forwarded-For;Then check and reload: nginx -t && systemctl reload nginx.
PHP and WordPress need nothing more: the web server now gives them the
visitor’s address in REMOTE_ADDR. No plugin is needed.
3. Check it works
Section titled “3. Check it works”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.
Firewalls on your server
Section titled “Firewalls on your server”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.allowandcsf.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.