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

524 A Timeout Occurred

Cloudflare-specific: a TCP connection was established but the origin did not reply within 100 seconds.

❓ Why does this happen?

Long-running requests (reports, exports, AI generation) exceed Cloudflare's 100-second proxy read timeout.

✅ How to fix it

Move long tasks to background jobs with polling or webhooks, or stream the response to keep the connection active.

Return or handle 524 in your stack

// Note: 524 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: "A Timeout Occurred", status: 524 },
    {
      status: 524
    }
  );
}

Live 524 mock endpoint

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

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

524 vs similar status codes

Frequently Asked Questions

What does HTTP Status 524 mean?
Cloudflare-specific: a TCP connection was established but the origin did not reply within 100 seconds.
Why am I getting a 524 status code?
Long-running requests (reports, exports, AI generation) exceed Cloudflare's 100-second proxy read timeout.
How do I fix a 524 A Timeout Occurred error?
Move long tasks to background jobs with polling or webhooks, or stream the response to keep the connection active.
What is the difference between 524 A Timeout Occurred and 522 Connection Timed Out?
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 524 response?
Send a request to https://castov.com/api/mock/524 — it returns a real 524 A Timeout Occurred 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.