Cloudflare error 524: a timeout occurred
Your server took longer than Cloudflare's 100-second limit to respond. Find the slow part and move long tasks to background jobs.
· 3 min read · By the Spot Downtime team
Error 524: A timeout occurred means Cloudflare connected to your server just fine, sent the request, and then waited too long for an answer. By default, Cloudflare waits 100 seconds for a proxied request. If your server hasn't started responding by then, the visitor gets a 524.
Your server is up. Something in it is slow, or the request is doing too much work for a single HTTP request.
Common causes
Long-running work in a request
Exports, report generation, image processing, bulk imports, or an admin action that loops over every record. These are fine with a hundred rows and time out with a hundred thousand.
A slow database query
A query on a table that grew, missing an index, or waiting on a lock held by another transaction. Check the database's slow query log around the time of the 524s.
A call to another service that hangs
Your code calls a payment provider or an internal API without a timeout. When that service is slow, your request waits as long as it does. Always set timeouts on outbound calls, well under 100 seconds.
Overloaded workers
All PHP-FPM or app workers are busy, so new requests queue. Each one is quick, but the wait in the queue pushes it past the limit.
How to fix it
- Move long tasks to a background job. Accept the request, queue the work, return
202 Acceptedand let the user poll or get notified when it's done. - Find the slow part. Your app's logs or APM show which endpoint and which query took the time.
- Bypass the proxy for genuinely long admin tasks, using a DNS-only (grey cloud) subdomain, if you can't move them to a background job yet.
# time a request directly at the origin, bypassing Cloudflare
curl -o /dev/null -s -w "ttfb: %{time_starttransfer}s\n" \
--resolve example.com:443:203.0.113.10 https://example.com/slow-pageSlow comes before down
Without Cloudflare, the same problem appears as a 504 Gateway Timeout from your own proxy.
Get new guides by email
Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.
Keep reading
- Cloudflare errors · DNS · TroubleshootingCloudflare error 1000: DNS points to prohibited IP, and how to fix itError 1000 means a proxied DNS record points at an address Cloudflare won't connect to, often its own IP. How to find the bad record and what to put there instead.November 23, 2026 · 6 min read
- Cloudflare errors · DNS · TroubleshootingCloudflare error 1001: DNS resolution error, causes and fixesError 1001 means Cloudflare could not resolve a hostname it needed. How to find the CNAME, Worker or custom hostname that points at a name with no address, and fix it.November 22, 2026 · 6 min read