Geonode logo
Website and server errors

How to Fix the Cloudflare 524 Error Code (A Timeout Occurred)

Cloudflare's exact time limits, what a visitor can do, and polling code for requests that run long.

Updated

TL;DR

A 524 error code means Cloudflare connected to the website's server, but the server sent no HTTP response within 125 seconds, Cloudflare's default limit. Visitors can only try again in a few minutes; the owner has to speed the request up or run it in the background.

What error 524 looks like

Captured from Cloudflare's own 524 preview page; a site with a custom error page shows that instead.

WhereWhat you see
Browser tab title (Cloudflare's default page)example.com | 524: A timeout occurred
Browser page, advice for the site ownerContact your hosting provider; check for long-running processes or an overloaded web server. / Use status polling of large HTTP processes to avoid this error.
Browser page, under What happened?The origin web server timed out responding to this request. The likely cause is an overloaded background task, database or application, stressing the resources on the host web server.
curl with default headerserror code: 524
JSON reply (curl --compressed -H 'Accept: application/json')"title":"Error 524: A timeout occurred" / "error_name":"origin_response_timeout" / "retryable":true,"retry_after":120,"owner_action_required":true
Python urlliburllib.error.HTTPError: HTTP Error 524: <none>
Node.js fetch() (res.status, res.statusText)524 <none>

Why this happens

Cloudflare passed your request to the site's server and gave up waiting for the answer.

Often one request asks for more work than the server can finish in time, such as a large data query or export. A server short of resources also fails to answer in time.

Diagnose your 524 first

The first two need only a browser; the rest are for developers and site owners.

  • Open another page on the site; if it loads, the server is up and only that one request is slow.

  • Recall how long the page hung; about two minutes means the server went silent, half a minute that Cloudflare could not finish sending the request.

  • Time it with curl --max-time 150 -o /dev/null -w '%{http_code} %{time_total}'; a 524 at about 125 seconds means the site keeps Cloudflare's default limit.

  • Repeat it with curl --compressed -H 'Accept: application/json'; error_name origin_response_timeout in the reply confirms Cloudflare wrote the 524, not your proxy.

  • As the owner, open Speed > Origin Analytics; if P95 origin response time nears the timeout line, Top endpoints lists the paths that are slow.

Solutions ranked by effectiveness

Card one is for visitors, two for the site's owner, three for scripts.

  1. Most common fix

    Retry in a few minutes, not sooner

    Applies when the site is not yours. Cloudflare's 524 page asks visitors to try again in a few minutes, because the delay is on the site's server.

    1. Check for a confirmation before resubmitting a form; the server may still have finished it.

    2. Reload once, and stop if the 524 comes back.

    3. Then send the site's owner the URL, the time and the Ray ID.

  2. Site owners

    Move long work out of the request

    Applies when the site is yours. Cloudflare's advice is to stop one HTTP request from waiting on a large job.

    1. Answer 202 Accepted with a status URL, then finish the job in the background.

    2. Put tasks that must run past 125 seconds on a DNS-only subdomain.

    3. Ask your host to rule out a long-running process or an overloaded server.

  3. For developers

    Start the job, then poll its status

    Applies when the API you call offers background jobs or exports. One short request starts the job; later ones ask for its status.

    import json, time, urllib.parse, urllib.request
    api = "https://api.example.com/exports"
    start = urllib.request.Request(api, method="POST")
    with urllib.request.urlopen(start, timeout=30) as res:
        status_url = urllib.parse.urljoin(api, res.headers["Location"])
    while True:
        with urllib.request.urlopen(status_url, timeout=30) as res:
            job = json.load(res)
        if job["status"] != "running":
            break
        time.sleep(5)
    print(job)

Stop the 524 from coming back

Server-side habits first; the last item is for scripts that call slow sites.

  1. Log each request's response time on your server, $request_time in nginx or %D in Apache, to spot slow URLs early.

  2. On Enterprise plans, raise the limit one second past your target; Cloudflare notes the 524 can fire a second off.

  3. With Cloudflare Tunnel, set cloudflared's origin timeouts as well; when both layers apply, the shorter one wins.

  4. Treat a DNS-only subdomain as unprotected: its record answers with your server's real IP address.

  5. In scripts, wait out the Retry-After header, 120 seconds on Cloudflare's 524 page, and cap your attempts.

Proxies for large downloadsGeonode ISP proxies keep the same IP across sessions and include unlimited bandwidth.
Try ISP proxies

Related errors

Learn more

FAQ

It is Cloudflare's A timeout occurred error: the site's own server was too slow to reply, so Cloudflare stopped waiting. 524 is not a registered HTTP status code, and over HTTP/1.1 it arrives with the reason phrase <none>.

A visitor cannot fix it: wait a few minutes, retry once and report it to the site. The owner makes the slow request faster or moves it to a background job with status polling.

Cloudflare waits 125 seconds by default, a limit it calls Proxy Read Timeout; Enterprise customers can raise it to 6,000 seconds by Cache Rule or API. A separate 30-second Proxy Write Timeout also ends in 524 and cannot be adjusted.

With 522, Cloudflare's timer ran out before any exchange began: no connection within 19 seconds, or no data on it within 90. With 524, the server took the request and then stayed silent past 125 seconds.

A 504 usually comes from a gateway the site runs itself, on that gateway's own timer. A 524 is Cloudflare's own page, sent when its wait for the site's server ends.

No: Cloudflare writes it when the site's server is too slow, whichever route the request took, and Geonode's error reference lists no 524 among its proxy codes. A client timeout under 125 seconds fires first and hides the 524.

Watch your average request duration

The ISP Proxies Statistics tab can show total requests, success rate and average duration.