The 504 error code, called Gateway Timeout, appears when one server asks another server for data and the answer does not come back in time. The first server then stops waiting and tells you so. Your phone and internet did their job: the request reached the website, and the slowness happened inside its own setup.
It is common during heavy traffic, with slow database tasks, and right after a site moves to new hosting. Messages include "504 Gateway Time-out", "HTTP Error 504" and, in apps, "Request failed with status code 504". The fixes below start with the easy ones for visitors and end with checks for owners.
Common causes
1The main server is too slow or overloaded
How to tellPages crawl for a while, then show 504
What fixes itWait and retry later; owner adds capacity
2A heavy task such as a report or big upload
How to tellOnly one action takes long and fails
What fixes itRetry with a smaller job; owner raises the time limit
3The back server is down or restarting
How to tellError appears suddenly, then is gone after minutes
What fixes itReload later; owner restarts the app service
4Slow database
How to tellPages that need saved data fail, plain pages load
What fixes itOwner checks database load and slow queries
5Network problem between servers
How to tellError is random, with no pattern
What fixes itOwner or host checks the routes and firewall
6Poor internet or VPN on your side
How to tellOthers can open the page, you cannot
What fixes itSwitch network, turn off VPN, flush DNS
How to fix it, step by step
Wait a minute and reload once
Give the back server time to catch up, then reload. Pressing F5 repeatedly adds more waiting jobs and may keep it jammed.
Compare on cellular data
Leave Wi-Fi for cellular data, or have a friend open the link. Should it fail there as well, let the site recover.
Open a lighter page of the site
If the home page works but search or checkout times out, the heavy part is overloaded. Try again at a quieter time, such as early morning.
Turn off VPN and restart the router
A slow VPN server adds delay. Disconnect it. Take the router's power away for sixty seconds, then restore it. For wider problems, see internet not working.
Flush DNS on Windows
Open Command Prompt, type
ipconfig /flushdnsand press Enter. This clears an old stored address, useful if the site recently moved to a new server.Do not repeat payments or forms
A 504 can appear after the server already processed your request. Before you pay or submit again, check your messages, order list or bank app to see if the first one went through.
Report it and return later
Give the support team the page, the time and your last action. Heavy sites often fix a timeout wave within a few hours.
504 error code meaning and where it sits
Like the 502, the 504 is a gateway code. A gateway is a server that forwards your request to another server and returns the result. When forwarding works but the reply takes beyond the set time limit, it reports a 504. In a 502 the reply arrives broken; in a 504 it simply does not arrive in time. Typical limits run from 30 to 100 seconds, depending on the setup.
You press Download Report in a portal and after a long wait see 504 Gateway Time-out. The report took longer to build than the gateway would wait. Retry with a shorter date range.
How 504 compares with 502 and 408
| Code | Who waited | Result |
|---|---|---|
| 502 | Gateway received a bad reply | Bad Gateway |
| 504 | Gateway received no reply in time | Gateway Timeout |
| 408 | Server waited for your request to finish | Request Timeout |
| 503 | Server cannot take new work | Service Unavailable |
Read the guides for 502 Bad Gateway, 408 Request Timeout and 503 Service Unavailable. A general overview of waits is in timeout error.
How owners fix a gateway timeout
- Find the slow task in the app log. A single large query is often responsible.
- Speed up the database with indexes and by removing needless queries.
- Move long jobs to the background and show a progress page instead of making users wait.
- Raise the proxy timeout carefully, but only after you have tried making the task faster.
- Check server load and add memory or workers if usage is always high.
Raising time limits alone hides the problem. Fix the slow task or the visitor will meet the next limit.
Status code 504 inside apps and logins
Apps print it as "Login error: request failed with status code 504". It means the login server was reached but the system behind it was too slow. Close and reopen the app, check for updates, and try again on a calmer connection. If many people report the same message, it is a service side delay, so wait.
Frequently asked questions
What does error code 504 mean?
It means a gateway server waited for a reply from another server and the reply took too long. The page could not be built in time.
Is a 504 caused by my internet?
Seldom. Your request reached the site. The delay is behind it. A very slow VPN or network can add to the delay, so testing mobile data is worthwhile.
How to fix 504 gateway timeout error as a visitor?
Wait, reload once, change network, turn off VPN and flush DNS. If others also see it, only the website can solve it.
What is the difference between 502 and 504?
A 502 means the gateway got an invalid reply. A 504 means it got no reply before time ran out.
How long does a 504 last?
A busy period may pass in minutes. A slow database or bad setting can last until the owner fixes it, which may take hours.