Skip to content

Cloudflare proxied mode in front of cPanel — what changes on the origin

Turning on the orange cloud changes more than the IP a visitor sees. Here is what the cPanel origin needs to know about real client IP, TLS, and rate limiting.

A cPanel host running fine in front of normal traffic moves behind Cloudflare’s proxy. Within a day: log files now show only Cloudflare IPs for every visitor, ModSecurity rate-limits the entire Cloudflare network as one client, AutoSSL fails its HTTP-01 challenge, and the customer asks why their HSTS-preloaded site is suddenly serving plain HTTP. None of these are Cloudflare bugs — they’re the predictable result of inserting a reverse proxy without telling the origin.

What’s happening

When Cloudflare proxies a record, every request to the origin comes from a Cloudflare IP. The original client IP travels in the CF-Connecting-IP header (and X-Forwarded-For for compatibility). The origin’s Apache, LiteSpeed, ModSecurity, mail logs, and rate limiters all see Cloudflare’s IPs unless they know to read the header.

TLS terminates at Cloudflare. The connection from Cloudflare to the origin is a separate TLS handshake (or HTTP if you misconfigured “Flexible SSL”). The origin’s cert is what Cloudflare validates against; the cert the visitor sees is Cloudflare’s. cPanel’s AutoSSL still issues an origin cert because Cloudflare connects to it over HTTPS.

The HTTP-01 ACME challenge requires the CA to reach /.well-known/acme-challenge/<token> over HTTP at the apex of the domain. With proxy on, that request hits Cloudflare’s edge — Cloudflare returns its own cached or non-existent response, not the cPanel origin’s. Either disable the proxy during issuance, switch to DNS-01, or use Cloudflare’s “Origin Server” certificate option.

How to verify

Confirm what the origin sees in access logs:

tail -50 /usr/local/apache/logs/access_log | awk '{print $1}' | sort -u | head
tail -50 /etc/apache2/logs/access_log | awk '{print $1}' | sort -u | head

If every IP is in Cloudflare’s published ranges, the origin is seeing only the proxy.

Confirm mod_remoteip (Apache) or equivalent is configured:

grep -r 'mod_remoteip\|RemoteIPHeader' /etc/apache2/conf/ /etc/httpd/conf/

Should reference CF-Connecting-IP as the trusted header from Cloudflare’s IP ranges.

Confirm TLS mode:

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | grep -E 'subject|issuer'

The subject should match example.com; the issuer is Cloudflare. The origin still needs a valid cert because Cloudflare requires HTTPS to the origin in “Full” or “Full (strict)” mode.

What to do

  1. Set Cloudflare’s SSL mode to “Full (strict)”. “Flexible” decrypts at Cloudflare and reconnects to origin over HTTP — never use it in production.
  2. Configure mod_remoteip on Apache or equivalent on LiteSpeed. The trusted header is CF-Connecting-IP. Trust only Cloudflare’s published IP ranges (refresh quarterly).
  3. Use Cloudflare’s “Authenticated Origin Pulls” so the origin only accepts connections that present Cloudflare’s client cert. This prevents attackers from bypassing the proxy by hitting the origin IP directly.
  4. Switch AutoSSL to DNS-01 challenge in WHM > AutoSSL Configuration. The DNS-01 challenge places a TXT record in _acme-challenge.example.com instead of requiring HTTP reachability. cPanel can publish the TXT via the local zone editor; if DNS is at Cloudflare, you’ll need a Cloudflare API token for AutoSSL or fall back to the per-renewal manual.
  5. Add ModSecurity exceptions for Cloudflare’s IPs and CF-Connecting-IP aware rate limiting. Otherwise ModSec sees one IP doing 1000 requests/minute and bans Cloudflare’s entire range.
  6. Block direct access to the origin IP at the cPanel host’s firewall, allowing 80/443 only from Cloudflare’s ranges. This forces all visitor traffic through the proxy.
  7. Keep mail, FTP, SSH, and operator panels DNS-only as before. Only HTTP/HTTPS goes through the proxy.

The benefit of proxied mode is the WAF, the caching, the bot mitigation, and the hidden origin IP. The cost is everything above. Decide whether the benefit justifies the operational complexity for the customer’s traffic profile.

Stack Harbor configures Cloudflare’s proxied mode end-to-end with mod_remoteip, DNS-01, and origin lockdown as part of deployment management.