524 A Timeout Occurred

Cloudflare connected to the origin server, but the origin took too long to send a response.

Last updated . How this page is checked.

Status code524
Status textA Timeout Occurred
Category5xx Server Error
Response has bodyUsually
Defined byCloudflare (not an IANA-registered code)

What does 524 A Timeout Occurred mean?

Cloudflare connected to the origin server, but the origin took too long to send a response. It is numbered in the 5xx Server Error range but is not a registered HTTP status code, so the general meaning of that class is only a rough guide to it.

When do APIs return 524?

On sites behind Cloudflare, when a request runs longer than Cloudflare will wait, which by default is on the order of two minutes. The connection was fine; the application was slow. Long database queries, report generation, large exports and imports are typical.

How to fix a 524 A Timeout Occurred

Shorten the request. Move long work to a background job: accept the request, answer 202 with a status URL, and let the client poll. Check the origin for slow queries and exhausted worker pools. The wait can be extended on Cloudflare's Enterprise plan, and requests to a hostname that is not proxied through Cloudflare are not subject to it, which is a common arrangement for a slow internal endpoint.

Reproduce a 524 response

The fastest way to understand a status code is to trigger one and read the full response. Open the API tester and send a request to https://httpbin.org/status/524 — you will see the 524 status along with every response header the server sent. Comparing those headers against a working request is often what reveals the cause.

That response only imitates the number, which is useful for checking how your own client, alerting or retry logic treats a 524. A real one comes from the software named in the table above, in the circumstances this page describes.

When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.

Related 5xx status codes

See also

  • 504 Gateway Timeout — A gateway or proxy did not receive a timely response from the upstream server.
  • 522 Connection Timed Out — Cloudflare tried to open a TCP connection to the origin server and got no answer in time.

References