Decoding Cloudflare Error 522 (Connection Timed Out)
Connection timed out. Error code 522.
This one showed up for me more than once, months apart, on the same site. It looks alarming, but it’s a specific, diagnosable problem once you understand what it’s actually reporting.
What 522 Actually Means
Cloudflare’s diagnostic usually shows three stages: Browser → Working, Cloudflare → Working, Host → Error. In plain terms: the request reached Cloudflare fine, but the actual origin — the server or Worker meant to answer — never responded in time.
The Most Common Real Cause: Conflicting Routing
In my case, both times, the underlying cause was the same: two different Cloudflare mechanisms trying to route the same domain to the same Worker at once — a Custom Domain attached directly to a Worker, and a separate Workers Route pointing at the same Worker. These two systems can overlap in ways that create a routing deadlock rather than a clean response.
Other Common Causes Worth Checking
- A missing or misconfigured DNS record
- An actual backend server that’s down or unreachable
- A Worker script with a bug that never returns a response — for example, accidentally fetching its own domain and creating an infinite loop
How to Actually Diagnose It
- Check your DNS records — make sure the relevant hostname has a record actually pointing somewhere valid
- Check for duplicate routing — look in both the Custom Domains tab and the separate Workers Routes section. Same hostname in both, pointing at the same Worker, is a strong candidate for the cause
- Check Worker logs (Observability → Logs) if a Worker is involved
The Fix
Remove one of the two overlapping mechanisms — typically keeping the Custom Domain attachment and deleting the separate Workers Route pointing at the same place, or vice versa. If your site is fully static with no need for a Worker, migrating fully to Cloudflare Pages removes this entire category of conflict. → Cloudflare Workers vs Pages
The Takeaway
Some errors aren’t things you fix once and forget — they’re things you learn to recognize on sight. 522 specifically means “Cloudflare is fine, your origin didn’t answer in time,” and in a lot of beginner cases, that traces back to routing configuration fighting itself.