Putting a CDN in front of cPanel is usually a good idea, but the deploy that stops at “I changed the DNS records” leaves the origin reachable on its public IP, leaves the cPanel host trusting any X-Forwarded-For it sees, and leaves the firewall logs full of bot scans that the CDN was supposed to absorb. The CDN is doing 30% of the job. We see this state on the majority of accounts that arrive already CDN-fronted.
What’s happening
A CDN terminates TLS, caches static responses, and proxies the dynamic ones to the origin. If the origin’s IP is still publicly reachable, attackers bypass the CDN entirely. If the origin still trusts the raw REMOTE_ADDR, every log line shows the CDN’s IP and not the real client. And if WAF rules live only at the CDN, the origin’s ModSecurity is doing nothing because the requests have already been filtered (or — worse — have not been, because the customer disabled WAF after a false-positive incident).
How to verify
From outside, check whether the origin IP is still reachable:
dig +short example.com
host example.com.cdn.cloudflare.net
curl --resolve example.com:443:<origin-ip> -I https://example.com/
If the last command returns the same content as the CDN-fronted URL, the origin is exposed. From the cPanel host:
grep cpsrvd /var/log/apache2/error_log | tail -20
tail -50 /var/log/apache2/access_log | awk '{print $1}' | sort -u
If access_log shows mostly Cloudflare IPs (103.21.244.0/22 and friends), the proxy is reaching origin correctly — but you also lose the real client IP unless mod_remoteip is configured. If you see public client IPs, the CDN is being bypassed.
The fix
- Restrict origin firewall. In CSF, allow inbound 443 only from the CDN’s published IP ranges. For Cloudflare, the lists are at
https://www.cloudflare.com/ips/. Drop everything else. - Restore real client IP. Enable
mod_remoteipin Apache (oruseipin LiteSpeed) and configure it with the CDN’s IP list as trusted proxies. Now logs show the real client. - Switch DNS A record to a generic origin name that is not the cPanel hostname. The cPanel default
srv1.example.comleaks the host. Useorigin.example.comand do not advertise it. - For Cloudflare specifically, enable Authenticated Origin Pulls: the CDN presents a TLS client certificate, the origin rejects requests without it. Now even if the IP leaks, only Cloudflare can reach origin.
- Decide where WAF lives. If at the CDN, keep ModSecurity on but with a permissive rule set; the CDN is the first line. If at the origin, keep the CDN WAF off to avoid double-filtering and false positives.
Once the origin is locked, the CDN is doing real protection — not just caching. Stack Harbor configures CDN + origin lockdown as part of cPanel server administration.