504 Gateway Timeout

What a 504 Gateway Timeout means, how slow upstream servers trigger it, how Googlebot treats timeouts, and the crawl-budget and indexing consequences.

First published: Jun 28, 2026 · Last updated: Jul 17, 2026 · Advanced
demand #3 in HTTP Errors#5 in HTTP Status Codes#23 in Technical SEO#31 on the site
1 evidence signal on this page

A 504 Gateway Timeout means a gateway or proxy (CDN, load balancer, reverse proxy) didn't get a timely response from the upstream server behind it. It's a timeout — different from a 502 (bad response) or a 503 (explicitly unavailable). It's not a Google penalty; it's an accessibility problem. Isolated 504s get retried, but sustained timeouts sit alongside 429/500/503 as the errors that make Googlebot back off and, if they persist, drop pages from the index. Identify which hop actually timed out before you fix anything — server response time (TTFB) is a strong preventive lever for slow origins, but raising the timeout value isn't a fix either way.

TL;DR — A 504 is a gateway/proxy telling you the upstream server didn’t respond within the timeout window — a timeout, distinct from a 502 (bad response) or a 503 (explicit unavailability). It’s an accessibility problem, not a penalty. Timeouts sit in the same bucket as 429/500/503: Googlebot backs off when it sees them, and sustained 504s risk deindexing. The durable fix is server response time (TTFB), not a longer timeout value — raising the timeout usually masks a slow upstream and can make things worse under load.

Where a 504 originates in the request chain

A modern request path looks roughly like: browser → CDN/edge → load balancer → reverse proxy (e.g. Nginx) → app server (PHP-FPM, Node, etc.) → database / third-party APIs. A 504 is generated by whichever component was waiting on the one behind it when its timeout expired. That’s the first diagnostic question: Evidence for this claim A 504 response means a gateway or proxy did not receive a timely response from an upstream server. Scope: RFC 9110 defines the timeout semantics; it does not determine why the upstream response was delayed. Confidence: high · Verified: IETF: RFC 9110 §15.6.5 — 504 Gateway Timeout

  • CDN/edge timing out on origin → the fix is origin performance, or raising the CDN’s upstream timeout (carefully — see below).
  • Load balancer timing out on the app server → check app-server health and autoscaling.
  • Reverse proxy timing out on the app process → look at Nginx’s proxy_read_timeout / fastcgi_read_timeout and the slow query or process that’s actually behind it.

Getting the layer right matters, because “fix the timeout at the edge” and “fix the slow database query at the origin” are completely different jobs.

What causes 504s

The status code itself doesn’t prove a cause — it only tells you a gateway timed out waiting on an upstream. These are the usual suspects worth checking, not facts the 504 already established; confirm with logs and traces before you act on one:

  • Slow database queries or upstream API calls. A single unindexed query or a laggy third-party dependency can push response time past the timeout.
  • Server/app overload and resource exhaustion. Under enough concurrent load, requests queue, worker processes fill up, and responses stop arriving in time.
  • Misconfigured timeout values across Nginx, Apache, the load balancer, or the CDN — often mismatched between layers so one gives up before another.
  • Traffic spikes, bot floods, or DDoS that overwhelm capacity temporarily.

504s are often intermittent and load-dependent

This is what makes them nasty. Unlike a hard outage, a 504 frequently appears only under load — which means an uptime monitor pinging during a quiet window can show 100% green while Googlebot, crawling in heavier bursts, is quietly collecting timeouts. In Google Search Console’s URL Inspection you may see this surface as a “Hostload exceeded” condition rather than a clean, constant error. If your monitoring says everything’s fine but Crawl Stats disagrees, load-dependent 504s are a prime suspect.

How Googlebot (and Bingbot) handle timeouts

Google doesn’t treat a 504 as a content-quality judgment — it’s an availability signal, and the response is automatic throttling. Its crawling docs are explicit: “Googlebot will scale back its crawling if it detects that your servers are having trouble responding to crawl requests.” The large-site crawl-budget guide says the same thing in budget terms: “If the site slows down or responds with server errors, the limit goes down and Google crawls less.” Evidence for this claim Google reduces crawling when server errors or slow responses indicate a site is having trouble responding. Scope: Google's documentation supports automatic crawl throttling for server trouble; it does not attribute a specific 504 to any particular bottleneck. Confidence: high · Verified: Google: Troubleshoot crawling errors

The freshest framing tying this straight to slow/timing-out responses comes from Google’s March 2026 Inside Googlebot explainer, where Gary Illyes is quoted saying: “If your server is struggling to serve bytes, our crawlers will automatically back off to avoid overloading your infrastructure, which will drop your crawl frequency.” (As reported by Search Engine Land’s coverage — worth confirming against the original recording or transcript if you’re citing it elsewhere.) A 504 is that struggle made visible.

One nuance worth understanding: Google doesn’t always see a literal “504” the way your browser does. If the timeout happens before Googlebot gets any status line at all, it’s logged as a timeout/network error in Crawl Stats rather than a clean 5XX. But when an intermediary proxy or CDN times out and generates its own 504 response, Googlebot receives a standard 5XX server error. Either way the effect is identical: throttled crawl rate, and, if sustained, removal from the index.

Bing documents timeouts as their own crawl-error category, separate from server errors — Bingbot stops trying to access pages when responses are too slow — and its standing recommendation is to check server response time, keep server software updated, optimize slow resources, and read server logs for systemic patterns rather than one-off blips. Bing hasn’t published the same level of throttle-and-recover detail Google has, so treat the two as broadly comparable in intent rather than confirmed to behave identically.

The throttle-then-recover feedback loop

The reassuring part: this loop is automatic and self-correcting. Google throttles down when it sees errors and timeouts, then ramps crawling back up gradually once responses are healthy again. There’s no manual “unthrottle” button you need to press once the underlying issue is fixed — as John Mueller noted, “Once things settle down on the server, the crawl rate will return to normal automatically.” He also flagged the asymmetry: throttling down happens fast to resolve an immediate problem; ramping back up is done cautiously.

Duration is what converts a blip into an indexing problem

Short, occasional 504s — a few during a spike, resolved quickly — get retried and are largely tolerated. What risks deindexing is a sustained pattern of timeouts over an extended window. Google’s documented “come back later” mechanics — where you intentionally return 503 or 429 during overload — describe roughly a two-day horizon before URLs start dropping, but that specific number is documented for 503/429 by name, not for 504. Google’s broader 5xx guidance says crawl rate drops proportionally to how many URLs are erroring and recovers gradually once responses are healthy, without naming a fixed horizon for 504 specifically. Extending the two-day figure to 504 is a reasonable inference, not a documented fact — treat it as: brief 504s are survivable, and a sustained pattern over days is the range where you should worry, not a guaranteed trigger date.

Why this matters more on large and ecommerce sites

If you have a small site whose pages get crawled the same day they publish, you’ll almost never notice this. But on large or fast-changing sites — big ecommerce catalogs, news, marketplaces — crawl budget is already the constraint, and a wave of 504s during peak load can starve crawling of pages that genuinely need to be recrawled. Timeouts and crawl budget are the same conversation at scale.

Server response time and TTFB are a strong preventive lever — for origin-side causes

Here’s a point most 504 articles miss: waiting until errors appear and then log-grepping is reactive. Monitoring server response time continuously, so you see the drift before it tips into a timeout, is proactive. A server that’s slow but not yet timing out today becomes a 504-generating server tomorrow under slightly more load or a slightly slower dependency. Watching TTFB (time to first byte) as an ongoing early-warning signal — not just a post-mortem metric — is how you catch that drift.

The caveat: TTFB monitoring addresses origin-side slowness. It won’t catch a CDN timing out on a healthy origin, a load balancer misconfigured to give up too early, or a network path problem between hops — those need the emitting hop identified first (the “Where a 504 originates” section above, or the decision tree below). TTFB is a real, durable fix for the common case of a genuinely slow upstream; it’s not a universal one. Once you’ve confirmed the origin is the bottleneck, optimize with caching (page, object, and CDN), faster database queries and proper indexing, autoscaling for load, and sensible CDN upstream tuning.

Why “just raise the timeout” is the wrong instinct

Bumping proxy_read_timeout or the CDN’s upstream timeout can stop the 504 from showing — but it doesn’t make the upstream response any faster. Worse, a longer timeout window under load means requests pile up and tie up worker processes and connections for longer, which can make an overload spiral worse, not better. Raising the timeout is occasionally the right call (for a genuinely long-running, well-understood operation), but as a reflex it masks the real problem.

When downtime is planned or you’re deliberately shedding load, the right tool isn’t letting pages 504 — it’s returning a 503 (with a Retry-After header) so you send search engines a clean, intentional “come back later” instead of a messy timeout.

Diagnosing a 504 in practice

Identify the emitting hop before you guess at a cause — that’s the difference between fixing the actual problem and fixing a symptom:

  • Reproduce it and identify which hop answered. Load it in a browser; hit it with curl and watch time_starttransfer for TTFB; run it through a crawler like Ahrefs Site Audit or Screaming Frog to see whether it’s site-wide or isolated. If you can, test direct-to-origin (bypassing the CDN/proxy) to see whether the origin itself completes.
  • Read the logs. Server and proxy logs tell you which layer timed out and, ideally, on what — the slow query, the stuck upstream, the exhausted worker pool. Correlate by timestamp and request ID across layers rather than assuming.
  • Check Search Console. Crawl Stats surfaces response-code spikes and average response time; the Page Indexing report and URL Inspection show whether Google is hitting timeouts (including “Hostload exceeded”).

Reconciling tools matters: a browser 504, an Ahrefs Site Audit 5xx, and a GSC timeout can all describe the same underlying slow origin seen from different vantage points. Don’t assume three tools mean three problems.

A 504 lives in a small family. A 500 is a generic server error with no more specific code; a 502 is a bad/garbled upstream response; a 503 is an explicit, often intentional “unavailable.” Knowing which one you’re actually returning — and returning the right one on purpose during planned downtime — is half the battle.

Try it live

This is a real endpoint on this site — not a simulation. Hit it from the button, open it in a new tab, or curl -i from your terminal, and the server answers with the actual status code this article is about.

Open in new tab ↗

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin an expert quote first.