How to Fix Cloudflare Error 524 (A Timeout Occurred)
What Error 524 means
Loading a Cloudflare-protected site is a relay race: Cloudflare connects to the site's real server — the "origin" — the origin acknowledges, starts sending its response, and must deliver the complete response before Cloudflare's timeout expires. Error 524 — "A timeout occurred" — means the first two legs went fine. Cloudflare connected, the origin acknowledged and began its reply. But the reply never finished. Cloudflare waited its full window — 100 seconds on every plan — and finally gave up and showed you the 524 page.
That makes 524 the twin of 522, with one important difference. A 522 server never answers at all; a 524 server answers and then stalls mid-reply, which usually means a specific process is running too long rather than the whole server being dead. Typical triggers: a database query waiting on a locked row, a report or export that churns for minutes, a script calling an external API that never returns, or a server so overloaded that the request that started can't get the resources to finish. Crucially, the rest of the site often loads fine — 524 usually strikes the heavy pages while everything else works, which is a strong clue for site owners.
Common causes
- Long-running or locked database queries: an unindexed query scanning a huge table, a transaction holding a row lock other requests are waiting on, or a migration running while visitors are active — the page starts, the query grinds, and the deadline passes.
- Heavy scripts that outlive the timeout: bulk imports and exports, report generators, backup routines triggered by a page load, or a plugin calling a slow external API — work that legitimately takes minutes crammed into one request.
- Overloaded server at peak times: CPU pinned at 100%, memory exhausted and swapping, or too few application workers for the traffic — requests that begin can't finish because the machine has nothing left to give them.
- Stuck application processes: a PHP worker wedged in an infinite loop, a WordPress cron task that never completes, or a deadlock between two services — the connection is held open while nothing useful happens.
- Huge responses on slow connections: occasionally the cause is simply size: an enormous uncompressed page or file that genuinely needs more than 100 seconds to stream on a slow origin uplink, especially from an under-resourced host.
How to fix Error 524 — step by step
Steps 1 through 3 are for visitors. Steps 4 through 6 are for site owners.
- Visitor: wait a few minutes and hard-refresh. 524 errors are frequently transient — a backup job hogging the server, a stuck cron task, or a traffic spike that has since passed. Cloudflare gives the origin 100 seconds to finish, so a stall that long clears on its own once the heavy work ends. Wait five to ten minutes, then hard-refresh: Ctrl+Shift+R on Windows or Cmd+Shift+R on Mac. A surprising number of 524s vanish with this alone.
- Visitor: rule out your own connection. Try the page in a private or incognito window, on your phone over mobile data, or with a down-detector service. If the site works anywhere else, the problem is on your path: restart your router, disable your VPN or proxy, and turn off ad-blocking extensions for a moment, then reload. If the 524 appears for everyone on every network, the origin is genuinely not finishing its responses and only the site owner can fix it.
- Visitor: stop hammering refresh and try again later. Repeatedly refreshing a 524 page only adds more unfinished requests to the server's pile and makes the stall worse. Once you have confirmed the error persists across refreshes, close the tab and come back in 20 to 30 minutes. Check the site's status page or social accounts for an incident note, and if the error has lasted for hours, use the site's contact page or social channels to let the owner know their server is timing out.
- Site owner: find the work that starts but never finishes. A 524 means the origin acknowledged Cloudflare and began responding, then stalled past the 100-second timeout — the classic cause is a request that does something expensive. Check the database slow-query log and the web server's process list for queries holding locks, PHP-FPM's slow log for scripts running past 30 seconds, and WordPress's cron for stuck tasks. Index or rewrite the slow query, kill the hung process, and disable plugins one by one until pages complete quickly again.
- Site owner: check server resources and worker counts. Look at CPU, memory, disk I/O, and your application server's worker pool when the 524s happen — a server at 100 percent CPU or deep in swap cannot finish anything within the deadline, and too few PHP-FPM or worker threads mean requests queue behind stalled ones. Common triggers are traffic spikes beyond the plan, backups or imports running during peak hours, and a runaway process eating cores. Scale up, move heavy jobs to quiet hours, and raise the worker count so queued requests are not waiting behind stuck ones.
- Site owner: make long requests finish faster, not run longer. Anything the visitor waits on must complete well inside Cloudflare's 100-second limit. Break large imports and exports into chunks, move report generation and bulk operations into background cron jobs or AJAX polling instead of one long page load, add caching in front of expensive pages, and stream partial output where the framework supports it. If you are on Cloudflare Enterprise, you can also raise the timeout ceiling — but cutting the request's own runtime is the durable fix.
Did this fix it? Quick checklist
- A hard refresh after waiting five to ten minutes loads the page (transient stall)
- A down-detector or another network confirms the error isn't just your connection
- The VPN, proxy, and ad-blocking extensions are off and the router was restarted
- Owner-side: slow queries and hung processes are cleared, server resources look healthy, and long-running tasks were moved to background jobs
If the 524 strikes at the same hour every day while everything else loads normally, suspect a scheduled heavy job — nightly report generation, batch imports, and scheduled exports that run during business hours produce exactly this pattern: the heavy pages time out while the rest of the site is fine. Owners should shift those jobs to quiet hours and check the slow-query log for what the job runs; visitors seeing a daily 524 can simply retry outside the window. And if a 524 has been solid for hours with no change, the origin is stuck in a way only the site's team can clear — check their status page or social accounts for an incident note rather than hammering refresh.
Frequently asked questions
What does Cloudflare Error 524 mean?
Error 524 — "A timeout occurred" — means Cloudflare connected to the website's origin server, the server acknowledged the connection and started sending a response, but the full response never arrived before Cloudflare's timeout expired. In plain English: the server began answering and then got stuck mid-reply. It is a server-side slowness problem on a request that takes too long to finish.
How is Error 524 different from 522, 521, and 520?
Each code describes a different point of failure between Cloudflare and the origin server. 521 means the origin refused the connection. 522 means the origin accepted the connection but never answered at all. 520 means the origin answered, but the answer was empty or broken. 524 is 522's twin: the origin answered and started its reply, but the reply never finished in time. For owners, 522 points at general slowness or firewall drops, while 524 points at a specific slow process — a hung query or a long-running script.
Is Error 524 my fault as a visitor?
No — a 524 happens between Cloudflare and the site's server, after the server already started responding. Your browser cannot cause it. A VPN or proxy can aggravate a slow site by adding latency on top, which is why it is worth retrying without one, but the root cause is a server-side process that takes too long to finish. Wait several minutes, hard-refresh, and if it persists for everyone, only the site owner can fix it.
How long does Cloudflare wait before showing a 524?
Cloudflare waits 100 seconds for the origin server to finish its response on all plan types. If the origin has not delivered the complete response by then, Cloudflare shows the 524 page. That is why the error often appears on heavy operations — large report generation, bulk imports, unindexed database queries — while the rest of the site loads fine. On Enterprise plans the timeout can be raised, but any request taking close to 100 seconds needs optimizing regardless.
I'm a site owner — what fixes a 524 fastest?
Start with the stalled work: check the database slow-query log and your application server's slow log for the request that starts and never finishes — index or rewrite the slow query, kill hung processes, and disable plugins one by one. Next, check resources: a server at 100 percent CPU or out of memory cannot finish in time, so scale up or move heavy jobs off peak hours. Finally, shorten the long requests themselves: chunk imports and exports, move heavy work to background jobs, and cache expensive pages. Retest through Cloudflare after each change.