Error 524: A Timeout Occurred (Cloudflare)
Updated Free mock REST & WebSocket APIs
Error 524 A Timeout Occurred — Cloudflare connected to the origin, but it didn't send an HTTP response within 100 seconds.
- Class
- 5xx Server Error
- Defined in
- Unofficial (Cloudflare)
- Official
- No — Cloudflare-specific
- Cacheable by default
- No (unless Cache-Control/Expires say so)
- Safe to retry
- Yes, after a delay (respect Retry-After)
Try it: get a real 524 response
Our test endpoint answers every request with 524 A Timeout Occurred.
curl -i https://mockfox.dev/api/status/524Use it in tests, health-check monitors or to see how your client handles a 524. Add ?delay=2000 to slow it down.
What does error 524 mean?
Error 524 "A timeout occurred" is a Cloudflare status meaning Cloudflare successfully connected to the origin, but the origin didn't return an HTTP response before the timeout — 100 seconds by default (Enterprise plans can raise it to 6,000 seconds).
The request may well still be running on the origin, which is why a 524 on a form submission can still result in the action completing.
When is 524 used?
- Long-running requests: reports, exports, imports, video processing.
- Slow database queries or locked tables.
- Origin overloaded and queueing requests.
Common causes of error 524
- Synchronous work that takes over 100 seconds.
- Resource exhaustion on the origin (CPU, DB connections, PHP workers).
- A hanging call to an external service with no timeout.
How to fix 524 A Timeout Occurred
If you're visiting the site
- Wait and check whether your action completed before retrying (to avoid duplicates).
- Try again later when the site is less busy.
If you run the site or API (developers)
- Move long jobs to background workers and poll for status (202 Accepted + status URL) or use webhooks/websockets.
- Stream the response or send progress so data flows before 100 s (Cloudflare resets the timer when bytes are received).
- Serve long-running endpoints from a grey-clouded (DNS-only) subdomain if they must be synchronous.
- Find slow queries with your database's slow-query log.
Returning or handling 524: server examples
Express (async job)
app.post("/api/export", async (req, res) => {
const job = await queue.add("export", req.body);
res.status(202).location(`/api/jobs/${job.id}`).json({ jobId: job.id });
});Next.js (stream progress)
// app/api/example/route.ts (Next.js App Router)
export async function GET() {
const stream = new ReadableStream({
async start(c) {
for await (const chunk of generateReport()) c.enqueue(new TextEncoder().encode(chunk));
c.close();
},
});
return new Response(stream, { headers: { "Content-Type": "text/plain" } });
}Example 524 response
HTTP/2 524 server: cloudflare cf-ray: 8d2f1a3b4c5d6e7f-IAD content-type: text/html; charset=UTF-8
Related status codes
- 504 Gateway TimeoutA gateway or proxy didn't get a response from the upstream server in time.
- 522 Connection Timed OutCloudflare's TCP connection to the origin timed out before it was established.
- 408 Request TimeoutThe server timed out waiting for the client to finish sending the request.
Related tools
Frequently asked questions
Can I increase Cloudflare's 100-second timeout?
Only on Enterprise plans (up to 6,000 seconds via the proxy read timeout setting). On other plans, make the request faster or asynchronous, or bypass Cloudflare for that endpoint.
524 vs 504?
Both are gateway timeouts. 524 is Cloudflare's own (100 s). A 504 behind Cloudflare usually comes from your origin's own proxy (e.g. nginx's 60 s default).
Did my request go through after a 524?
Possibly — the origin keeps processing after Cloudflare gives up. Check before retrying non-idempotent actions.