What 522 means
522 is not a standard HTTP status code; Cloudflare's edge sends it. It means Cloudflare's attempt to talk to your origin server timed out: either the TCP connection never completed because the origin didn't answer Cloudflare's connection request in time, or the connection opened but the origin never acknowledged the request Cloudflare sent over it. In both cases Cloudflare heard nothing back, which is different from an outright refusal (521).
HTTP/2 522
server: cloudflare
cf-ray: 8c1f2a3b4d5e6f70-LHR
content-type: text/html
<title>example.com | 522: Connection timed out</title>
Common causes
- A firewall silently dropping Cloudflare's packets: a rule, fail2ban ban or provider-level DDoS protection that drops (rather than rejects) traffic from Cloudflare's IP ranges.
- An overloaded origin: the server is too busy to accept new connections, for example its listen backlog or connection limit is full.
- Wrong IP address in the Cloudflare DNS record, pointing at an address where nothing answers (an old server, an address the host has reassigned).
- Network or routing problems between Cloudflare and the origin's network.
- Keep-alive disabled on the origin, so Cloudflare has to open many new connections.
- An IPv6
AAAArecord for an origin that doesn't actually serve IPv6.
How to fix it
-
Check the DNS records in the Cloudflare dashboard: every proxied
AandAAAArecord must point at the origin's current public address. RemoveAAAArecords the server doesn't serve. -
Test the origin directly, bypassing Cloudflare:
curl -sv --connect-timeout 10 --resolve example.com:443:203.0.113.10 https://example.com/A hang here means the origin or the network in front of it isn't answering.
-
Allowlist Cloudflare's IP ranges (listed at
cloudflare.com/ips) on ports 80 and 443 in iptables/ufw, fail2ban, security plugins and the hosting provider's firewall. Rate-limiting tools often ban Cloudflare's addresses because all visitors appear to come from them; restore the visitor IP fromCF-Connecting-IPfirst. -
Check the origin's load: CPU, memory, open connections and the web server's worker limits. Scale up, or cache more at Cloudflare to reduce origin traffic.
-
Enable keep-alive on the origin web server.
-
If the origin answers direct tests but 522s continue, send your host a traceroute from the origin towards a Cloudflare IP, and give Cloudflare support the
cf-rayIDs.
522 and SEO
Googlebot receives the 522 from Cloudflare and treats it as a server error. While it continues Google lowers its crawl rate, and URLs that keep failing over a long period are removed from the index. Intermittent 522s under load are an early sign of an origin that needs more capacity.
Related codes
- 521 Web Server Is Down: the origin refused the connection instead of ignoring it.
- 523 Origin Is Unreachable: Cloudflare has no route to the origin.
- 524 A Timeout Occurred: connected fine, but the HTTP response took too long.
- 504 Gateway Timeout: the standard timeout from a proxy.
Check what visitors see with the Redirect Checker, and confirm your DNS records point where you expect with DNS Lookup.