# 504 Gateway Timeout

> A 504 Gateway Timeout means a proxy or CDN waited too long for the server behind it. See who causes it and how to fix it in nginx, Apache and CDNs.

Canonical: https://scaplet.com/errors/http/504

Guide Error · HTTP status codes

A 504 Gateway Timeout means a proxy or CDN waited too long for the server behind it. See who causes it and how to fix it in nginx, Apache and CDNs.

4 min

read

8

sources

Oct 21, 2026

updated

Scaplet Editorial Team

author

504 5xx · Server error

The short answer

A 504 Gateway Timeout means a server acting as a gateway or proxy, such as nginx or a CDN, did not get a response in time from the upstream server it needed. The slow or unreachable part is behind the proxy, not your device. Visitors can retry; owners should find what is slow or blocked between the proxy and the origin.

1. [What a 504 means and who causes it](#what-a-504-means-and-who-causes-it)
2. [How to get past a 504 as a visitor](#how-to-get-past-a-504-as-a-visitor)
3. [How to find the cause as a site owner](#how-to-find-the-cause-as-a-site-owner)
4. [What it does to SEO](#what-it-does-to-seo)

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%20(%22504%20Gateway%20Timeout%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%20(%22504%20Gateway%20Timeout%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%20(%22504%20Gateway%20Timeout%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F504%20(%22504%20Gateway%20Timeout%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_Who causes a 504

## What a 504 means and who causes it

RFC 9110 says a 504 "indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request." The proxy is working. It gave up waiting. MDN draws the line with [502 Bad Gateway](/errors/http/502): with a 504 the proxy "did not receive any HTTP response from the origin within a certain time", while a 502 is an invalid response.

Layer

### Origin application

Typical cause

A slow query, a long job inside a web request, an overloaded server

Who can fix it

Site owner or developer

Layer

### Network path

Typical cause

A firewall or security group blocks the proxy; the origin is not reachable from the internet

Who can fix it

Site owner or host

Layer

### Proxy or CDN settings

Typical cause

A timeout shorter than the slowest legitimate request

Who can fix it

Site owner

Layer

### Visitor network

Typical cause

VPN, DNS, firewall or proxy settings, when the site works for others

Who can fix it

Visitor

_02_How it works

## How to get past a 504 as a visitor

1. 1

### Wait and reload

If the origin is slow because of a traffic spike or a long task, a retry a little later may work. MDN says the site "may work again at a later time".
2. 2

### Check whether it is only you

MDN names client networking errors as the exception, particularly if the service works for other visitors and if clients use VPNs or other custom networking setups. Try another network or turn the VPN off.
3. 3

### Avoid repeating a payment or form submission

A 504 does not tell you whether the origin finished the work after the proxy stopped waiting. Check your account or email for the result before submitting again.

_03_Timeouts that produce a 504, by stack

## How to find the cause as a site owner

Separate "slow" from "unreachable". Time a request to the origin directly. If it succeeds but takes longer than the proxy timeout, you have a slow application. If it hangs or fails to connect, you have a network or firewall problem.

Stack

### nginx (HTTP upstream)

Setting

`proxy_read_timeout`

Documented default or limit

60s, measured between two successive reads, not for the whole response

Stack

### nginx (PHP-FPM)

Setting

`fastcgi_read_timeout`

Documented default or limit

60s, same rule

Stack

### nginx (connecting)

Setting

`proxy_connect_timeout`

Documented default or limit

60s; the docs say it "cannot usually exceed 75 seconds"

Stack

### Apache

Setting

`ProxyTimeout` in mod_proxy

Documented default or limit

Defaults to the value of `Timeout`

Stack

### Cloudflare

Setting

Proxy Read Timeout ([error 524](/errors/http/524))

Documented default or limit

Default 125 seconds; Cloudflare says Enterprise plans can raise it up to 6,000 seconds

Stack

### CloudFront

Setting

Origin response timeout

Documented default or limit

Set per origin on the distribution; an ELB origin has its own 10 second connection timeout and an idle timeout

Time each phase of an origin request

```
curl -sS -o /dev/null -w "dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s first byte %{time_starttransfer}s total %{time_total}s\n" https://origin.example.com/slow-page
```

Raise the read timeout for one slow route only

```
location /reports/ { proxy_pass http://127.0.0.1:8000; proxy_read_timeout 120s; # default is 60s }
```

Raising a timeout is a patch. CloudFront's documentation says "Server timeouts are often the result of either an application taking a very long time to respond, or a timeout value that is set too low", and recommends addressing performance and latency issues before raising its timeout. For a job that legitimately runs for minutes, Cloudflare suggests status polling: return 202 Accepted right away, finish the job in the background, and let the client check for the result.

**Cloudflare 524 is not a standard code**Error 524 is Cloudflare's own code, used when it connected to the origin but got no HTTP response in time. It is not defined in RFC 9110. The standard status for the same situation is 504, and Cloudflare also returns 504 itself in some cases.

For CloudFront, check these first, as AWS lists them: a firewall or security group that blocks CloudFront traffic, a custom origin that is not reachable on the internet (private servers and internal Classic Load Balancers cannot be origins), then slow application responses. Test reachability with `nc -zv origin.example.com 443`.

Causes and fixes differ by server and platform. See the 504 guides for [nginx](/errors/http/504/nginx).

_04_Explained

## What it does to SEO

Google handles a 504 like other [5xx errors](/errors/http/5xx-errors). Its crawlers temporarily slow down, content received from those URLs is ignored, and already indexed URLs are preserved but eventually dropped. Once the server starts responding with a 2xx [status code](/glossary/http-status-codes) again, Google gradually increases the crawl rate. See [5xx server errors](/seo-issues/server-errors-5xx) and Google's documentation on how HTTP status codes affect its crawlers.

Related errors: [Apache](/errors/http/504/apache), [IIS](/errors/http/504/iis), [API Gateway](/errors/cdn/api-gateway-504), [Netlify functions](/errors/cdn/netlify-function-timeout), [Vercel functions](/errors/cdn/vercel-function-invocation-timeout).

Sources · 8

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- rfc-editor.org
- mozilla.org
- amazon.com
- cloudflare.com
- nginx.org
- apache.org
- google.com

1. 01 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) rfc-editor.org · checked 2026-10-25
2. 02 [MDN: 504 Gateway Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/504) developer.mozilla.org · checked 2026-10-25
3. 03 [Amazon CloudFront: HTTP 504 status code (Gateway Timeout)](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-504-gateway-timeout.html) docs.aws.amazon.com · checked 2026-10-25
4. 04 [Cloudflare: Error 524](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/) developers.cloudflare.com · checked 2026-10-25
5. 05 [nginx: ngx_http_proxy_module](https://nginx.org/en/docs/http/ngx_http_proxy_module.html) nginx.org · checked 2026-10-25
6. 06 [nginx: ngx_http_fastcgi_module](https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) nginx.org · checked 2026-10-25
7. 07 [Apache HTTP Server: mod_proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html) httpd.apache.org · checked 2026-10-25
8. 08 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-10-25

Questions

## Asked a lot.

4 questions people ask next, answered from the sources on this page.

_01_ How do I fix a 504 gateway timeout?

Find out whether the origin is slow or unreachable. Time a direct request to it. If it is slow, fix the query or job and only then raise the proxy timeout. If it cannot be reached, check firewalls, security groups and DNS between the proxy and the origin.

_02_ Is a 504 error my fault?

Usually not. The proxy waited for an upstream server and did not get a response in time. The exception is your own network: MDN says VPN, firewall, proxy and DNS settings can cause it when the site works for other visitors.

_03_ Does a 504 mean the website is down?

Not necessarily. The proxy is answering, but a server behind it is slow or unreachable. Other pages that do not depend on that server may still work, and the site may work again later.

_04_ What is the difference between 504 and 408?

A 504 is the gateway telling you the upstream server was too slow to answer it. A 408 is a server telling a client that it did not receive a complete request in time. See [408 Request Timeout](/errors/http/408).

## Keep learning

[All errors](/errors)

[Learn 502 Bad Gateway HTTP status codes](/errors/http/502) [Related 5xx server errors Status codes and links](/seo-issues/server-errors-5xx) [Read next HTTP 408 Request Timeout HTTP status codes](/errors/http/408) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 504 errors
[API Gateway 504 Gateway Timeout](/errors/cdn/api-gateway-504) [Cloudflare 504 Gateway Timeout](/errors/cdn/cloudflare-504) [504 Gateway Time-out in nginx](/errors/http/504/nginx) [504 Gateway Timeout in Apache](/errors/http/504/apache) [504 Gateway Timeout on IIS](/errors/http/504/iis)

Nearby in errors
[503 Service Unavailable on Squarespace](/errors/http/503/squarespace) [503 Service Unavailable in WordPress](/errors/http/503/wordpress)

More in HTTP status codes
[418 I'm a Teapot](/errors/http/418) [421 Misdirected Request](/errors/http/421) [422 Unprocessable Content (Unprocessable Entity)](/errors/http/422) [423 Locked](/errors/http/423) [424 Failed Dependency](/errors/http/424) [425 Too Early](/errors/http/425) [426 Upgrade Required](/errors/http/426) [428 Precondition Required](/errors/http/428) [429 Too Many Requests](/errors/http/429) [451 Unavailable For Legal Reasons](/errors/http/451) [502 Bad Gateway](/errors/http/502) [503 Service Unavailable](/errors/http/503) [504 Gateway Timeout](/errors/http/504) [505 HTTP Version Not Supported](/errors/http/505) [506 Variant Also Negotiates](/errors/http/506) [507 Insufficient Storage](/errors/http/507) [508 Loop Detected](/errors/http/508) [510 Not Extended](/errors/http/510) [511 Network Authentication Required](/errors/http/511) [5xx errors](/errors/http/5xx-errors) [HTTP 200 OK](/errors/http/200) [HTTP 201 Created](/errors/http/201) [HTTP 204 No Content](/errors/http/204) [HTTP 206 Partial Content](/errors/http/206)

Terms on this page
[HTTP status codes](/glossary/http-status-codes)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
