Skip to main content
524

A Timeout Occurred

Active
None (Cloudflare proprietary) N/ASince 2010Long-running API requests, slow database queries behind Cloudflare proxy

HTTP 524 A Timeout Occurred is a Cloudflare-specific status meaning the TCP connection to the origin succeeded and the HTTP request was sent, but the origin took too long to send back an HTTP response. Cloudflare's proxy read timeout (100 seconds for Enterprise, 60–100 seconds for other plans) was exceeded. The origin is reachable but slow.

Description

524 is an application-layer timeout. The full TCP handshake completed, TLS negotiated, the HTTP request was transmitted – but the origin server held the connection open without sending an HTTP response until Cloudflare's proxy read timeout expired. This is distinct from 522 (TCP handshake never completed) and 523 (DNS/routing failure). Common causes: a slow database query, a synchronous long-running task blocking the response, a deadlock, or an OOM condition causing the origin process to hang.

Examples

524 scenario: slow database query
http
# Client sends:
POST /api/report/generate HTTP/1.1
Host: api.example.com

# Origin starts a 3-minute report query...
# Cloudflare waits 100 seconds...
# Cloudflare returns 524 to the client
HTTP/1.1 524 A Timeout Occurred
Server: cloudflare
CF-RAY: 8a1b2c3d4e5f0001-ORD
Fix: move long operations to background jobs
http
# Instead of blocking on the long operation:
POST /api/report/generate
→ HTTP 202 Accepted
  Location: /api/jobs/report-abc123

# Client polls:
GET /api/jobs/report-abc123
→ HTTP 200 { status: "processing", progress: 45 }
→ HTTP 200 { status: "complete",    result_url: "..." }

Edge Cases

  • Cloudflare Enterprise plans can increase the proxy read timeout beyond 100 seconds via Cloudflare support. Non-enterprise plans cannot change this timeout.
  • WebSocket connections maintained through Cloudflare have a separate idle timeout (100 seconds without data) – different from the HTTP response timeout.
  • A 524 from a streaming endpoint usually means the first byte of the response wasn't sent within the timeout. The fix is to flush headers immediately and then stream the body.
  • If the origin starts sending chunked response data within the timeout, the 524 won't fire – Cloudflare resets its timer when any response bytes arrive.

When You'll See This

  • Long-running database queries (aggregations, reports, full table scans)
  • Synchronous file generation (PDF, Excel export) blocking the HTTP thread
  • External API call in the request path that itself times out
  • Deadlocked database connection pool – all connections waiting
  • Memory pressure causing garbage collection pauses on the origin
  • First-byte timeout on a streaming endpoint – flush headers immediately

Implementation References

LanguageConstant
Go524 (no standard constant)
Node.js524 (Cloudflare proprietary)
Pythonresponse.status_code == 524

History

Part of Cloudflare's 520–527 proprietary range. 524 specifically addresses the application-layer timeout scenario: transport connected, but origin application is too slow to respond.

Related Status Codes

Related Headers

FAQ

How do I fix a 524 error?

The root cause is always the origin taking too long. Solutions in order of preference: (1) Optimize the slow operation (query optimization, caching, indexing). (2) Move the long operation to a background job and return 202 Accepted immediately with a polling URL. (3) If the operation must be synchronous, use streaming – flush the response headers immediately so Cloudflare sees a first byte and resets its timer. (4) For Cloudflare Enterprise, request a proxy_read_timeout increase.

What is the difference between 524 and 504?

504 Gateway Timeout is the standard HTTP status code for a gateway timing out waiting for an upstream. 524 is Cloudflare-specific and means the same thing from Cloudflare's perspective – but 524 is only generated by Cloudflare's edge, whereas 504 can be returned by any proxy or load balancer (nginx, HAProxy, AWS ALB).