A 504 Gateway Timeout means a server acting as a gateway or proxy waited for the server behind it, and no response arrived in time.
This guide explains what sits behind that message, what a visitor can check in two minutes, and how site owners fix it on nginx, Cloudflare, AWS and Azure.

The fastest way to get past a 504 Gateway Timeout
Most 504 errors are on the website's side and clear on their own once the server catches up. As a visitor, run through these checks in order and stop when the page loads.
- Wait a minute, then press F5 or select the reload button to request the page again.
- Check the URL for typos and load a different page on the same site.
- Open the page on another device or on mobile data instead of your Wi-Fi.
- If it loads elsewhere, turn off your VPN or custom proxy and reload.
- If the page still fails everywhere, the problem is the site's server. Try again later or report the error, the time and the URL to the site owner.
What does 504 Gateway Timeout mean and how to fix it
Most websites do not answer you from a single machine. Your request passes through a gateway first: a CDN such as Cloudflare, a load balancer, or a reverse proxy such as nginx. That gateway forwards the request to the upstream (origin) server that builds the page.
A 504 is the gateway telling you it gave up waiting. It is a 5xx server error, defined in the HTTP Semantics standard (RFC 9110), so the fault is almost never your browser.
| Stage in the request | What happens | Where a 504 comes from |
|---|---|---|
| 1. Your browser | Sends the request to the site's public address | Not here; the browser only displays the error |
| 2. Gateway or proxy (CDN, load balancer, nginx) | Receives the request and forwards it upstream | Starts a timer while it waits for the upstream reply |
| 3. Upstream or origin server | Runs the application, database queries and scripts | Is slow, overloaded, crashed or unreachable |
| 4. Timer runs out | The gateway receives no HTTP response in time | The gateway returns 504 Gateway Timeout to you |
The wording varies by server. "504 Gateway Time-out", "HTTP Error 504" and "Gateway Timeout Error" all mean the same status code.
Is a 504 Gateway Timeout your problem or the website's?
| What you see | Where the fault is | What to do |
|---|---|---|
| The site fails on every device and network | The site's gateway or origin server | Wait and retry, or contact the site owner |
| The site works for others but not for you | Your network, VPN, proxy, firewall or DNS | Follow the visitor fixes below |
| You own the site and see a Cloudflare-branded 504 | Your origin server returned the 504 | Check the origin and any proxy in front of it |
| You own the site and see a blank 504 page with no branding | The error came from Cloudflare itself | Contact Cloudflare Support with the details listed below |
| You own the site and it runs behind nginx or a cloud load balancer | The app behind the proxy is too slow or unreachable | Check the upstream first, then the timeout settings |
504 vs 502, 503, 524 and 408: how they differ
Several status codes look alike on screen. The difference tells you where the request broke, and whether you need the fixes for a 503 Service Unavailable error or a 500 Internal Server Error instead.
| Code | Meaning | Key difference from 504 |
|---|---|---|
| 504 Gateway Timeout | The gateway got no response from the upstream server in time | No reply at all arrived before the timer ran out |
| 502 Bad Gateway | The gateway received an invalid response from the upstream server | A reply arrived, but it was broken or unusable |
| 503 Service Unavailable | The server cannot handle the request right now | The server answered, and said it is unavailable |
| 524 (Cloudflare only) | Cloudflare connected to the origin but got no response within its Proxy Read Timeout, 125 seconds by default | A Cloudflare-specific timeout code, not a standard HTTP status |
| 408 Request Timeout | The server gave up waiting for the client to finish sending its request | A 4xx client-side timeout; the slow party is the browser, not the upstream |
Fix a 504 Gateway Timeout on your own device
Use these steps only when the site works for other people. MDN lists client network settings, firewall setup, proxy settings and DNS configuration as the usual visitor-side causes, especially with VPNs.
- Restart your modem and router, then reload the page.
- Disconnect your VPN, or switch it to a different server, and reload.
- Open the page in an Incognito or InPrivate window to rule out extensions and cached data.
- Clear your browser's cookies and cached files for the site, then reload.
- Flush the Windows DNS cache with the command in the next section.
- If your work or school network uses a proxy, ask its administrator whether the site is blocked or slow through it.
Leave your antivirus and firewall switched on. If you suspect one of them, check its log or allow list for the site rather than turning protection off.
Clear the DNS cache from Command Prompt
A stale DNS entry can send your browser to an old server address that no longer answers. Open Command Prompt, then run:
ipconfig /flushdns
Flushes and resets the Windows DNS client resolver cache, discarding negative entries and any entries added dynamically.
You should see: The command finishes without an error message. Close Command Prompt and reload the page; a fresh DNS lookup now happens for the site.
How site owners fix a 504 Gateway Timeout
A 504 on your own site means some layer between the visitor and your application stopped waiting. Cloudflare's own guidance notes that the cause is not always in the origin server's error logs, so check every hop.
- Record the exact error, the time with its time zone, and the full URL that failed.
- Check whether the origin server is up and answers requests for that hostname directly.
- Look at CPU, memory and connection load on the origin at the time of the error.
- Find the slow request: a long database query, a large export or a stuck script.
- Read the logs of every load balancer, cache, proxy and firewall between the gateway and the origin.
- Fix the slow code or add capacity first. Raise the gateway timeout only for requests that legitimately run long.
- For jobs that take minutes, return a response at once and let the client poll for the result.
How to check a 504 Gateway Timeout is fixed
- Load the failing URL in a private browser window, so no cached error page is shown.
- Open the browser's developer tools, select the Network tab and reload.
- Confirm the page request now shows status 200 instead of 504.
- Repeat the request that was slow before, such as the report or export, and watch that it completes.
- On Cloudflare, check that 5xx errors have dropped in the zone's analytics; on AWS, watch HTTPCode_ELB_504_Count fall to zero.
Fix a 504 Gateway Timeout on nginx, Cloudflare, AWS and Azure
"504 Gateway Time-out" page from nginx
nginx closed the connection because the proxied or FastCGI server sent nothing within its timeout, 60 seconds by default.
- Check the upstream application first, such as the app server or PHP-FPM pool, for crashes, full worker pools or slow queries.
- For a proxied app, raise
proxy_read_timeoutin thehttp,serverorlocationblock, for exampleproxy_read_timeout 120s;. The timer runs between two successive reads, not for the whole response. - For PHP or another FastCGI backend, raise
fastcgi_read_timeoutin the same way. - If the connection itself is slow to open, check
proxy_connect_timeout; nginx notes it usually cannot exceed 75 seconds. - Apply the change with
nginx -s reload, run as the same user that started nginx.
Cloudflare-branded 502 or 504 error page
Your origin web server returned a standard 502 or 504 to Cloudflare, which passed it on.
- Make sure the origin responds to requests for the hostname in the failing URL.
- Investigate heavy server load, crashes or network failures at the origin.
- Identify applications or services on the origin that timed out or were blocked.
- Ask your hosting provider to check with the error code, time, time zone and URL.
Blank 502 or 504 page with no branding on a Cloudflare site
The error came from Cloudflare, sometimes because the origin serves broken gzip content or a wrong content-length header.
- Disable compression at the origin briefly to see whether the error stops.
- Browse to
yourdomain/cdn-cgi/traceand save the output. - Send Cloudflare Support that output, the failing URL and the timestamp with its time zone.
Cloudflare error 524 instead of 504
Cloudflare reached the origin, but the origin sent no HTTP response within the 125-second Proxy Read Timeout.
- Find the long-running process on the origin, such as a large data query, and speed it up.
- Move requests that routinely exceed 125 seconds to a subdomain set to DNS only (grey cloud) in Cloudflare DNS.
- On an Enterprise plan, raise the Proxy Read Timeout with a Cache Rule or the zone setting API, up to 6,000 seconds.
504 from an AWS Application Load Balancer
The load balancer could not connect to the target within 10 seconds, or the target did not answer before the idle timeout.
- Check that the target is running and responding within the load balancer's idle timeout.
- Confirm the subnet's network ACL allows traffic from the targets to the load balancer nodes on ephemeral ports 1024-65535.
- Check that the target's content-length header matches the body it actually sends.
- For Lambda targets, check that the function responds before the connection timeout.
504 from Azure Application Gateway
The backend did not answer within the request time-out, 20 seconds by default. On the v2 SKU the gateway retries a second backend member, and a second failure returns 504.
- In the Azure portal, open your application gateway.
- Under Settings, select Backend settings.
- Select the backend setting used by the affected backend pool.
- Raise Request time-out (seconds); the accepted range is 1 to 86400.
- Select Save, then investigate why the backend is slow.

Why raising the gateway timeout does not fix a 504
Raise a gateway timeout only for requests that are slow by design, such as exports or reports, and fix the backend for everything else. Microsoft's Application Gateway guidance warns that a longer time-out masks high CPU, memory pressure, database contention or an inefficient query. Visitors still wait, and the next traffic spike brings the 504 back.
504 Gateway Timeout FAQ
What does 504 Gateway Timeout mean?
It means a server acting as a gateway or proxy did not get a response in time from the upstream server it forwarded your request to. The website's backend was too slow or unreachable, so the gateway stopped waiting and returned the 504 status code.
What does "504 Gateway Time-out" with a hyphen mean?
It means exactly the same as 504 Gateway Timeout. The hyphenated wording is simply how some servers, such as nginx, label the error page. The status code is identical, and so are the causes and fixes.
What does a 504 gateway timeout error mean for a visitor?
For a visitor, it usually means the website's server is overloaded or down, not that your device is broken. Reload after a minute. If the site works for other people but not you, check your VPN, proxy, firewall and DNS settings.
Why does a website say 504 Gateway Timeout?
The site shows 504 because its gateway, such as a CDN, load balancer or reverse proxy, waited for the application server and got nothing back in time. Common reasons are heavy traffic, a slow database query, a crashed app or a network fault between servers.
What does 502 gateway timeout mean, and is it the same as 504?
They are different codes. A 502 Bad Gateway error means the gateway received an invalid response from the upstream server. A 504 Gateway Timeout means it received no response at all within its time limit. Both point to the server side.
What does 504 Gateway Timeout mean on nginx?
On nginx, it means the proxied or FastCGI server sent nothing within the read timeout, which is 60 seconds by default. Fix the slow backend first, then raise proxy_read_timeout or fastcgi_read_timeout if the request is slow by design.
What does 504 bad gateway timeout mean?
"Bad gateway timeout" mixes two codes. If the page shows 504, the gateway timed out waiting for the upstream server. If it shows 502, the gateway got a broken reply. Read the number, since it tells you which one happened.
Can clearing the browser cache fix a 504 error?
Only when the fault is on your side, which is rare. Clearing cached files and cookies, flushing DNS or opening a private window helps if the site works elsewhere. If the site is down for everyone, only the site owner can fix it.
504 Gateway Timeout fixes: bottom line
As a visitor, retry once and test another network; as a site owner, find the slow upstream before touching any timeout value. A 504 is a server-side status that only says a gateway stopped waiting. The lasting fix is making the backend answer in time, with longer timeouts kept for jobs that genuinely need them.





