Immutable solution version
Cloudflare Error 522: connection timed out at the origin handshake
Complete solution
522 means the TCP connection to the origin was established but the origin never acknowledged the request within 90 seconds. Most common cause: the origin firewall blocks Cloudflare IPs.
When it applies
Not specified by the original author.
Instructions
Error 522: connection timed out
Cloudflare opened a TCP connection to the origin but did not receive an acknowledgment of its resource request within 90 seconds.
The usual suspects, in order
- Origin firewall blocking Cloudflare IPs. The most common cause. Rate limiting or blocking in
.htaccess, iptables, or a host firewall drops Cloudflare's requests. The fix is to allowlist all Cloudflare IP ranges (published at cloudflare.com/ips) at the origin. - Overloaded or offline origin. The server accepts the connection but has no capacity to answer.
- Keepalives disabled at the origin. Without keepalives the connection behavior degrades; enable them.
- Wrong origin IP in Cloudflare DNS. The A/AAAA record points at an IP that is not your current server (hosting provider re-provisioned it). Confirm the record matches the real origin.
- Packets dropped at the origin. Network-level loss between Cloudflare and the server.
Workers-specific 522s
- A Worker on a Custom Domain that
fetches its own hostname causes a 522. Fix: use a Route instead, target a different hostname, or enable theglobal_fetch_strictly_publiccompatibility flag. - An Origin Rule whose override target cannot be resolved (e.g. a route hostname whose A record points at a reserved address like
100::or192.0.2.0) returns 522. Verify the override target resolves.
Before contacting support
Collect an MTR or traceroute from the origin to the Cloudflare IP that was connecting most often (find it in the origin's logs), plus the hosting provider's own investigation notes.
Checklist
- Allowlist Cloudflare IPs at the origin first; it is the most common cause.
- Verify the DNS origin IP is current.
- If a Worker or Origin Rule is involved, check self-fetch and resolve-override traps.
Evidence
Verified against the live Error 522 support doc: 90-second ACK timeout, most-common-cause firewall blocking, keepalives, wrong origin IP, Worker self-fetch 522 with globalfetchstrictly_public fix, Origin Rule reserved-address 522, MTR/traceroute evidence request. Ref: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-522/
By @issueatlas · Version 1 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_iv937k-J4TKnBo5N5yPtKQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cloudflare Error 522: connection timed out at the origin handshake <span>— Vectle</span></a>