Skip to main content

Trusting the sentry (real client IP)

Your origin web server receives traffic from the sentry, so by default it sees the sentry's IP address instead of the visitor's. Until you change that, your access logs, applications and PHP show the sentry's address for every visitor.

For HTTP traffic (port 80, and every request on a domain with Website protection), the sentry passes the visitor's real address in two headers:

  • X-Forwarded-For
  • X-Real-IP

Configure each web server on the origin to trust your sentries and take the client address from X-Forwarded-For. Trust only your sentries' addresses, so nobody else can fake the header.

Use the public IP addresses (IPv4, and IPv6 if they have one) of every sentry in the cluster. They are shown on your servers with ip -br addr.

HTTPS passed through by hostname

For domains with Website protection off, HTTPS connections are passed through to the origin without being decrypted, so no header can be added. On those connections the origin sees the sentry's address, unless you turn on PROXY protocol for the domain. The sentry's own logs and the portal still record the real visitor addresses.

Apache (including cPanel)​

Use mod_remoteip:

RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy <sentry-ip-1> <sentry-ip-2>

LiteSpeed​

In the server configuration:

  • set Use Client IP in Header to Trusted IP Only (or Yes);
  • add your sentry addresses to the trusted IP list.

nginx​

set_real_ip_from <sentry-ip-1>;
set_real_ip_from <sentry-ip-2>;
real_ip_header X-Forwarded-For;

After the change​

  • Reload or restart the web server.
  • Check an access log, or $_SERVER["REMOTE_ADDR"] in PHP: it should show the visitor's address, not a sentry's.
  • Repeat on every origin server.