Skip to content
HTTP errors in web scraping and automation · error message

HTTP: 504 Gateway Timeout

RetryableHTTP 504Server-side failures (500, 502, 503, 504)

Last verified

The exact message
504 Gateway Timeout

What it means

504 means a gateway or proxy waited for the upstream server and gave up before a response arrived. The connection to the gateway worked; the application behind it was too slow.

In automation the usual trigger is an expensive request: a large export, an unfiltered search, a big page size, or many concurrent requests that queue up behind each other. A 504 is different from a timeout in your own client: here the server-side gateway timed out and told you so. Cloudflare reports its version of this as error 524.

What is not wrong: your network to the site, and usually your request format.

What it looks like

<html><head><title>504 Gateway Time-out</title></head>
<body><center><h1>504 Gateway Time-out</h1></center></body></html>

Why it happens

  • The requested operation takes longer than the gateway's timeout.
  • The upstream server is overloaded and requests are queuing.
  • Large page sizes or unfiltered queries.
  • A dependency of the site (database, third-party API) is slow.

How to fix it

  1. Retry later with backoff.
  2. Request smaller pages or narrower date ranges.
  3. Reduce concurrency so requests are not queuing behind each other.
  4. Use an asynchronous export or bulk endpoint if the API offers one.
  5. If you own the site, find the slow endpoint in upstream logs and either speed it up or move it to a background job with polling.

How to stop it recurring

Paginate, filter and batch requests so each one is cheap, and prefer bulk or async APIs for large data. Set your own client timeout slightly above the expected response time so you notice slowness. Monitor response times per host; steadily rising latency usually precedes a wave of 504s and is the moment to slow down.

Official documentation: developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/504. See all HTTP error messages.

Related errors

Definitions

Quick answers

What does "504 Gateway Timeout" mean in HTTP?

504 means a gateway or proxy waited for the upstream server and gave up before a response arrived. The connection to the gateway worked; the application behind it was too slow. In automation the usual trigger is an expensive request: a large export, an unfiltered search, a big page size, or many concurrent requests that queue up behind each other.

How do I fix "504 Gateway Timeout"?

1. Retry later with backoff. 2. Request smaller pages or narrower date ranges. 3. Reduce concurrency so requests are not queuing behind each other. 4. Use an asynchronous export or bulk endpoint if the API offers one. 5. If you own the site, find the slow endpoint in upstream logs and either speed it up or move it to a background job with polling.

Retries and timeouts without writing the loop

Autonoly's HTTP Request node and browser steps have per-node retries, timeouts and continue-on-fail, so a transient 429 or 503 can back off instead of failing the run. It has no proxies or IP rotation: if a site blocks automated traffic, that block applies to Autonoly too.

Also see Error handling in workflows.