Skip to main content
HTTP/5xx (Server Error)

522 Connection Timed Out

Cloudflare-specific: the TCP handshake with the origin server timed out.

❓ Why does this happen?

Origin overloaded, wrong DNS A record, or firewall silently dropping packets from Cloudflare.

✅ How to fix it

Verify the origin IP in DNS, check server load, and confirm ports 80/443 are open to Cloudflare.

Return or handle 522 in your stack

// Note: 522 is normally generated by Cloudflare, not your app.
// Emitting it yourself is only useful for testing client error handling.
// app/api/resource/route.ts
export function GET() {
  return Response.json(
    { error: "Connection Timed Out", status: 522 },
    {
      status: 522
    }
  );
}

Live 522 mock endpoint

Point your app, tests, or retry logic at this free public URL to reproduce a real 522 response (CORS enabled, optional ?delay=ms up to 5000).

https://castov.com/api/mock/522

522 vs similar status codes

Frequently Asked Questions

What does HTTP Status 522 mean?
Cloudflare-specific: the TCP handshake with the origin server timed out.
Why am I getting a 522 status code?
Origin overloaded, wrong DNS A record, or firewall silently dropping packets from Cloudflare.
How do I fix a 522 Connection Timed Out error?
Verify the origin IP in DNS, check server load, and confirm ports 80/443 are open to Cloudflare.
What is the difference between 522 Connection Timed Out and 524 A Timeout Occurred?
522 is a TCP connection timeout to the origin. 524 means the connection succeeded but the origin took longer than 100 seconds to respond.
How can I test how my app handles a 522 response?
Send a request to https://castov.com/api/mock/522 — it returns a real 522 Connection Timed Out response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 5xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.