Cloudflare Error 522: Connection timed out
Cloudflare could not complete a TCP handshake with your origin within ~19 seconds. Allow Cloudflare IP ranges in your firewall, check the origin IP in DNS, and confirm the server listens on 0.0.0.0:443/80.
Identify: does your log match?
HTTP/2 522
server: cloudflare
cf-ray: 8d2f51c09a7b3e22-IAD
content-type: text/html; charset=UTF-8
Error 522 Ray ID: 8d2f51c09a7b3e22 • 2026-10-20 14:02:51 UTC
Connection timed out
You Browser Working
Ashburn Cloudflare Working
www.example.com Host Error- High
Firewall drops Cloudflare IPs
iptables, ufw, a security group or fail2ban drops SYN packets from Cloudflare ranges. No RST is sent, so the connect times out.
- Medium
DNS points to the wrong origin IP
The proxied A record still points at an old server or a private IP that Cloudflare cannot route to.
- Medium
Origin overloaded or bound to localhost
The backlog is full, or the app listens on 127.0.0.1 only, so external connections never complete.
Fix
Allow Cloudflare IP ranges on the origin
sudo ufw default deny incoming sudo ufw allow 22/tcp sudo ufw enable
for ip in $(curl -s https://www.cloudflare.com/ips-v4) $(curl -s https://www.cloudflare.com/ips-v6); do sudo ufw allow proto tcp from "$ip" to any port 443 sudo ufw allow proto tcp from "$ip" to any port 80 done sudo ufw reload
Cloudflare connects from its published ranges only. Allowing them (and nothing else) keeps the origin private and reachable.
Verify: reproduce it on purpose
$ curl -sv --connect-timeout 20 --resolve www.example.com:443:203.0.113.10 https://www.example.com/ -o /dev/nullRun it against a dev environment to trigger 522 on purpose and test your error handler.
Prevent
- Monitor the origin directly, bypassing Cloudflare.
- Use Cloudflare Tunnel to avoid exposing origin ports.
- Alert on 522 rate in Cloudflare Analytics.
FAQ
What is the difference between Cloudflare 522 and 524?
522 means the TCP connection never opened. 524 means it opened but the origin did not send an HTTP response within 100 seconds.
Why do I get 522 only from some countries?
Geo-blocking or rate limiting on the origin firewall may drop specific Cloudflare data center ranges.
Can I raise the 522 timeout?
No. The connection timeout is fixed; fix reachability or capacity at the origin.
Related errors
Last verified 2026-10-20 · Source: Cloudflare 1xxx and 5xx error reference · Official docs ↗ · ~27,100 searches/mo