524 A Timeout Occurred
Slow origin servers failing to deliver an HTTP response within the timeout window trigger Cloudflare's 524 A Timeout Occurred status code. The TCP connection succeeded but the origin did not respond in time.
Usage
Cloudflare is a content delivery network acting as a reverse proxy between clients and origin servers. The 524 error means the TCP handshake completed and Cloudflare sent the HTTP request, but the origin server did not return a response within Cloudflare's timeout window. The default timeout is 125 seconds, extendable through Cloudflare configuration.
Common causes include:
- Long-running server-side processes such as database queries, report generation, or large file processing.
- The origin application is deadlocked or stuck in an infinite loop.
- Resource exhaustion on the origin server (CPU, memory, or I/O).
Cloudflare allows raising the read timeout through a Cache Rule with the Proxy Read Timeout setting or through the zone settings API.
Example
A client sends a request for a resource requiring heavy server-side computation. The origin server does not respond within 125 seconds, and Cloudflare returns a 524 timeout error.
Request
GET /reports/annual HTTP/1.1
Host: www.example.re
Accept: application/pdf
Response
HTTP/1.1 524 A Timeout Occurred
Date: Mon, 02 Mar 2026 10:35:00 GMT
Content-Type: text/html
Server: cloudflare
CF-RAY: 8a1b2c3d4e5f6-DFW
<html>
<head><title>524 Timeout</title></head>
<body>
<h1>Error 524</h1>
<p>A timeout occurred</p>
</body>
</html>
Why raising the origin timeout fails
Cloudflare stops waiting after 125 seconds for the first response byte, and separately after 30 seconds for a write to complete. The read timeout is the only value in Cloudflare's proxy limits customers can adjust, and the ceiling rises to 6,000 seconds through Cloudflare configuration.
The consequence catches people out. Increasing
max_execution_time, proxy_read_timeout, or an
equivalent at the origin has no effect on 524,
because the origin was never the component giving up.
Cloudflare returns the error while the origin
continues working.
Three approaches resolve the condition. Making the response faster is the durable answer. Moving a long-running endpoint to a DNS-only subdomain removes the proxy from the path entirely, which suits report generation and bulk exports. Raising the limit through Cloudflare covers the remainder.
The adjustment works through a cache rule setting the proxy read timeout, or through the zone setting directly. The cache rule carries one condition: the content needs to be cacheable for the rule to trigger, without needing to be cached.
Observed timing runs about a second past the configured value, which Cloudflare documents as expected behavior rather than a fault.
How to fix
The default proxy read timeout is 125 seconds, and raising it requires Cloudflare configuration. The origin must begin sending a response within this window, or Cloudflare drops the connection with a 524.
Profile the slow origin endpoint. Identify long-running database queries, blocking API calls, or CPU-intensive processing consuming the full timeout window. Optimize these operations to return a response faster.
Monitor origin performance in the Cloudflare Origin Analytics dashboard. The P95 response-time metric surfaces endpoints approaching the Proxy Read Timeout, allowing intervention before requests start returning 524 errors.
Move long-running tasks to a background worker (a queue system like Celery, Sidekiq, or SQS). Return an immediate 202 Accepted response with a task ID, and have the client poll a status endpoint for the result. This pattern keeps individual request times well below the timeout.
For processes requiring extended time, move the endpoint behind a DNS-only (gray-clouded) subdomain in Cloudflare DNS. Traffic to a DNS-only record bypasses Cloudflare's proxy and its timeout limits entirely.
Cloudflare configuration increases the timeout (up to
6,000 seconds) through a Cache Rule with the Proxy Read
Timeout setting. The content must be cacheable for the
rule to activate, though Caching is not
required. The
proxy_read_timeout value is also adjustable through
the Cloudflare zone settings API. A 1-second variance
between the configured and actual timeout is expected,
so set the value 1 second higher than the target.
The proxy write timeout is 30 seconds and is not adjustable. Requests served through Cloudflare Images use a shorter write timeout of 6.5 seconds. Ensure the origin reads the full request body within this window.
See also
- 522 Connection Timed Out
- 408 Request Timeout
- 504 Gateway Timeout
- Troubleshooting Cloudflare Errors
- HTTP status codes