Server errors (5xx)

504 Gateway Timeout

A server in the middle waited too long for the website server.

Quick answer

A 504 means a gateway or proxy in front of the website did not get an answer from the real server in time. The real server may be slow, stuck or unreachable.

When to wait: Often yes. Try again in a few minutes.

If you are visiting the website

  1. Wait and reload Wait a few minutes, then reload the page once. Short slowdowns often pass on their own.
  2. Check the service's status page Big services often publish an official status page that lists known problems.
  3. Ask for less at once If the error appears on a big search, report, export or upload, try a smaller one. Large tasks are the ones most likely to run past the time limit.
  4. Do not resubmit straight away A form or order may still finish on the server after the timeout. Check your email or account before you send it again.
  5. Test without your VPN or proxy A company proxy or VPN can produce its own 504 if it cannot reach the site in time. Turn it off once to compare, then back on.
  6. Tell the website owner If it keeps happening, contact the site and name the page, the action you tried and the time.

If you run the website

  1. Find slow requests Check which pages, API calls or database queries take too long. Slow query logs and request timing in your access logs point to the culprit.
  2. Move long tasks to the background Let reports, imports and exports run as background jobs and show progress or send the result later. Visitors should not wait on one long request.
  3. Raise proxy timeouts only with care In nginx, proxy_read_timeout defaults to 60 seconds between two reads. Raising it can help a known slow endpoint, but it hides slow code and ties up connections.
  4. Check the network path Make sure the proxy can reach the server and that firewalls allow it. A dropped route looks like a timeout to the proxy.
  5. Check your hosting provider's status Your host may have a known outage. Their status page or support can confirm it.

Is it the website or me?

Almost always the website. A server in front of the site waited for the real server and gave up.

Your own connection was good enough to reach that middle server. Only a VPN or proxy you use yourself could be involved.

How 504 differs from 502 and Cloudflare 524

A 502 means the middle server got a broken answer. A 504 means it got no answer in time.

Cloudflare shows 524 instead when the website does not answer within its own wait time, which is 125 seconds by default.

For developers: what happens technically

A gateway or reverse proxy did not receive a timely response from the upstream server. Each layer has its own timeout, so the shortest one decides when visitors see the error.

Check timeouts in the proxy, the app server and any load balancer together.

Common questions

Is a 504 caused by my internet connection?

Very rarely. The delay happened between servers on the website's side. Your connection reached the front server without trouble.

Will it work if I wait?

Often yes, if the server was briefly overloaded. If the same big action always fails, waiting will not fix it; the owner must speed it up.

Why does it only happen on big reports or uploads?

Those requests take the longest to finish. When they run past the proxy's time limit, the proxy stops waiting and shows 504.

Should site owners just raise the timeout?

Only as a short-term fix for a known slow task. The lasting fix is making the request faster or moving the work into the background.

Did my order or upload go through after a 504?

Possibly. The server may have finished the work after the proxy stopped waiting. Check your account, email or the upload list before you try again.

Likely causes

  • Common The website server is overloaded or a slow task blocks it. (Website side)
  • Sometimes A network problem between the proxy and the server. (Website side)

Is the website down? Check it now

One measurement point. Results explain what we saw, not a worldwide verdict.

Sources

Last reviewed: