524
HTTPERRORNotable5xx Server Error (Cloudflare)HIGH confidence

A Timeout Occurred

Production Risk

Medium — affects only long-running requests. Migrate long operations to async jobs to resolve permanently.

What this means

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.

Why it happens
  1. 1The origin server is processing a long-running request (database query, file processing, external API call) that exceeds 100 seconds.
  2. 2The origin server is hung or deadlocked on a particular operation.
  3. 3A slow database query is holding up the response.
  4. 4The origin is under heavy load and cannot respond to all requests within the timeout.
How to reproduce

A data export endpoint that generates a large CSV from a database query takes 120 seconds — exceeding Cloudflare's 100-second limit.

trigger — this will error
trigger — this will error
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.

Convert long operations to async background jobs
# 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 done

Why 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.

Enable Cloudflare's 'No timeout' for specific routes (Enterprise)
# 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.

What not to do

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.

Version notes
Cloudflare

Cloudflare's origin read timeout is 100 seconds on free/pro/business plans. Enterprise plans can extend this.

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors