A 522 Connection Timed Out from Cloudflare means Cloudflare’s edge tried to open a TCP connection to your cPanel origin, waited around 15 seconds, and gave up. The cause is at the network layer (a firewall blocking Cloudflare IPs), the listener layer (Apache or LiteSpeed not bound), or the host layer (the box is overloaded and not accepting new connections). The fix path is from the edge backwards.
What’s happening
Cloudflare’s edge connects to the origin IP on port 80 or 443. If the TCP handshake does not complete within ~15 seconds, Cloudflare returns 522 to the user. Common causes are CSF or iptables blocking the Cloudflare edge ranges, Apache being stopped, the origin IP being wrong in the Cloudflare DNS panel, or the host being slammed (high load average, can’t accept new sockets). cPanel does not log 522 — Cloudflare does, but the underlying TCP timeout is visible from the origin.
How to verify
From outside the cPanel host (so not via Cloudflare):
# is the origin reachable on the expected ports?
nc -zv <origin-ip> 80
nc -zv <origin-ip> 443
# does the origin answer HTTPS with the right cert?
curl -ILk --resolve example.com:443:<origin-ip> https://example.com
On the cPanel host:
# is Apache or LiteSpeed listening?
ss -lnp | grep -E ":(80|443) "
# is CSF blocking the Cloudflare ranges?
csf -g 173.245.48.0/20 # one of Cloudflare's ranges
# is the box overloaded?
uptime ; ss -s
# DNS — what IP does Cloudflare resolve the origin to?
dig +short example.com @1.1.1.1
The fix
- CSF must allow Cloudflare — the up-to-date IPv4 and IPv6 ranges live at
https://www.cloudflare.com/ips/. Add to/etc/csf/csf.allow(or use the Cloudflare CSF plugin), restart CSF. - Apache or LiteSpeed restart —
systemctl status httpdor/usr/local/lsws/bin/lswsctrl status. If down, start it. If running but not accepting connections,ss -lnpwill show no listener — restart. - Origin IP mismatch — in Cloudflare DNS, the A record should point at the cPanel host’s public IP, not an internal LAN address. If a private IP is listed, Cloudflare cannot reach it.
- Host overload —
uptimeshowing load > number of cores, with TCP accept queue full (ss -sshows synrecv > 0), means the box is dropping connections. Find the load source:top,iotop,htop. - MTU or path issue — rare, but a downstream firewall stripping ICMP and breaking PMTU discovery can cause silent timeouts to large packets. Test with
mtr <cloudflare-edge-ip>.
If 522s only hit at peak hours, the box is undersized for the workload — Stack Harbor handles capacity reviews and Cloudflare-origin tuning under managed cPanel operations — start a conversation when 522s correlate with load.