A Timeout Occurred
Production Risk
Medium — affects only long-running requests. Migrate long operations to async jobs to resolve permanently.
524 A Timeout Occurred is a Cloudflare-specific error indicating that Cloudflare successfully established a TCP connection to the origin server, but the origin did not send an HTTP response within Cloudflare's 100-second timeout window.
- 1The origin server is processing a long-running request (database query, file processing, external API call) that exceeds 100 seconds.
- 2The origin server is hung or deadlocked on a particular operation.
- 3A slow database query is holding up the response.
- 4The origin is under heavy load and cannot respond to all requests within the timeout.
A data export endpoint that generates a large CSV from a database query takes 120 seconds — exceeding Cloudflare's 100-second limit.
GET /export/all-data.csv HTTP/1.1 Host: example.com # Origin processes for 120s → Cloudflare times out at 100s
expected output
HTTP/1.1 524 A Timeout Occurred
Fix 1
Convert long operations to async background jobs
WHEN The operation consistently takes more than 100 seconds.
# Return 202 Accepted and process in background
POST /export → 202 {job_id: 'abc123'}
GET /export/status/abc123 → poll until ready
GET /export/download/abc123 → retrieve when doneWhy this works
Eliminates the need to hold an HTTP connection open for long operations.
Fix 2
Enable Cloudflare's 'No timeout' for specific routes (Enterprise)
WHEN You have Cloudflare Enterprise and the long timeout is intentional.
# Cloudflare Enterprise: use proxy_read_timeout settings # Or use Cloudflare Workers to handle the routing differently
Why this works
Extends the timeout limit for specific endpoints that legitimately require more than 100 seconds.
✕ Do not try to keep HTTP connections open for operations exceeding 100s through Cloudflare
Cloudflare's hard limit is 100 seconds on free/pro/business plans. Use async patterns instead.
Cloudflare's origin read timeout is 100 seconds on free/pro/business plans. Enterprise plans can extend this.
Cloudflare 5xx error documentation
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#524 ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev