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/522522 vs similar status codes
Frequently Asked Questions
What does HTTP Status 522 mean?
Why am I getting a 522 status code?
How do I fix a 522 Connection Timed Out error?
What is the difference between 522 Connection Timed Out and 524 A Timeout Occurred?
How can I test how my app handles a 522 response?
Other 5xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.