522 Connection Timed Out

Cloudflare tried to connect to your origin server at the network level and got no answer in time. The request never reached your web server software.

What 522 means

A 522 is a timeout at the TCP layer, before any HTTP is exchanged. Cloudflare documents two triggers:

  • it sends a SYN to open the connection and receives no SYN+ACK from the origin within 19 seconds; or
  • the connection is established, Cloudflare sends the request, and the origin does not acknowledge it within 90 seconds.

Both are silence. Nothing said "no" (that would be a 521); packets went out and nothing came back. Because the failure is below HTTP, your web server's access log will usually have no entry for the request.

Do not confuse it with 524, where the connection works and the application is slow to produce a response.

Common causes

  • A firewall dropping Cloudflare's packets. Cloudflare calls this the most frequent cause: its addresses are blocked or rate limited by iptables, .htaccess rules or a hosting firewall. A rule with a DROP action produces exactly this silence.
  • An overloaded or offline origin. A machine that is out of CPU, memory or connection slots stops completing handshakes. A host that is powered off or disconnected from the network does not answer at all.
  • The wrong origin address. The A or AAAA record in Cloudflare's DNS points at an IP that no longer belongs to your server.
  • Keepalives disabled at the origin. Cloudflare reuses connections and recommends leaving keepalives on.
  • Packet loss on the network path between Cloudflare and the origin.

How to test each one

  • Address: compare the IP in the Cloudflare DNS record with the server's current public address.
  • Reachability: from outside, run curl -sv --connect-timeout 10 --resolve example.com:443:203.0.113.10 https://example.com/ with your origin's IP. If that works, the origin is up and something is treating Cloudflare's addresses differently.
  • Firewall: list the rules (iptables -S, ufw status, the hosting control panel, fail2ban-client status) and look for Cloudflare ranges. Allow all of Cloudflare's IP ranges, and put per-client rate limits on the visitor address Cloudflare passes in CF-Connecting-IP, not on the connecting address.
  • Load: check CPU, memory and the number of open connections at the time of the errors. Intermittent 522s at peak times are a capacity problem.
  • Network: if all of that is clean, Cloudflare's support asks for an MTR or traceroute from the origin to a Cloudflare IP address that has connected to it recently.

To block by country, use a rule in Cloudflare's WAF. Blocking address ranges at the origin tends to catch Cloudflare's own.

522 compared with 521, 523 and 524

CodeLayerWhat Cloudflare saw
521TCPConnection refused
522TCPNo reply to the connection attempt, or no acknowledgement of the request
523IP routingNo route to the origin's address
524HTTPConnected and request acknowledged, then no response before the read timeout

Without Cloudflare, the nearest standard code is 504 Gateway Timeout. As a visitor you can only wait, or confirm that the site is down for others too.

Example 522 response

HTTP/2 522
date: Sat, 14 Nov 2026 09:52:30 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
cf-ray: 8e2a2bf1ac0d93b4-FRA

Time the request when you reproduce a 522. The error arrives only after Cloudflare has waited out its connection timeout, so a response that takes many seconds to fail is typical; an instant failure is more likely a 521.

Documented in Cloudflare docs: Error 522.

Questions

What causes error 522 Connection timed out?

Cloudflare could not complete a TCP connection to the origin server in time. The usual reasons are a firewall on the origin silently dropping Cloudflare's IP addresses, a server that is overloaded or offline, or a DNS record in Cloudflare that points at the wrong IP address.

What is the difference between 522 and 524?

A 522 happens at connection level: the origin never completed the TCP connection or never acknowledged the request. A 524 happens later: the connection worked and the request was received, but the application did not send an HTTP response before Cloudflare's read timeout.

How do I allow Cloudflare through my firewall?

Add allow rules for every range on Cloudflare's published IP list, for ports 80 and 443, ahead of any blocking or rate-limiting rules. Also exclude those ranges from tools such as fail2ban, which can ban them because so many requests arrive from so few addresses.

Why is my 522 error intermittent?

Intermittent 522s usually mean the origin is sometimes too busy to accept new connections, or a rate limiter is occasionally blocking a Cloudflare address. Match the times of the errors against server load and firewall logs.