HTTP: 504 Gateway Timeout
Last verified
504 Gateway TimeoutWhat 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
- Retry later with backoff.
- Request smaller pages or narrower date ranges.
- Reduce concurrency so requests are not queuing behind each other.
- Use an asynchronous export or bulk endpoint if the API offers one.
- 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
- CAPTCHACAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a challenge-response m
- Cloudflare Bot ManagementCloudflare Bot Management is the set of Cloudflare features (Bot Fight Mode, Super Bot Fight Mode and the Ente
- DataDomeDataDome is a commercial bot-protection service that scores every request to a website, app or API in real tim
- HUMAN Security (PerimeterX)PerimeterX, now HUMAN Security's Bot Defender after a 2022 merger, is a bot-protection service that scores eve
- User AgentA user agent is a string that browsers send with every HTTP request identifying the browser type, version, and
- AI Web ScraperAn AI web scraper is an AI-powered data extraction tool that understands page structure, identifies relevant d
- Data ScrapingData scraping is the broad practice of programmatically extracting data from any digital source — websites, ap
- Web CrawlerA web crawler (also called a spider or bot) is a program that systematically browses the internet by following
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.