loot.tools
504

Gateway Timeout

5xx Server Error

The server, acting as a gateway, didn't get a timely upstream response.

504 Gateway Timeout means a proxy or gateway waited for an upstream server and gave up before it answered. The upstream isn't necessarily down - it's just too slow, often because of a long query, a stuck external call, or an undersized timeout. It differs from 502, where the upstream replied but the reply was invalid.

What 504 looks like on the wire

GET /api/reports/annual HTTP/1.1
Host: example.com

HTTP/1.1 504 Gateway Timeout
Server: nginx
Content-Type: text/html

About 5xx Server Error

The server failed to fulfill a valid request. The problem is on the server side, not the client.

How to fix 504 Gateway Timeout

  • Find the slow upstream operation - a query, lock, or external call.
  • Raise the proxy's upstream timeout if the work is legitimately long.
  • Move long jobs to a background queue instead of the request path.
  • Check upstream health and capacity under load.

Where it's defined

504 Gateway Timeout is defined in RFC 9110 §15.6.5. MDN's 504 reference covers browser behavior and examples.

Looking for a different one? See the full HTTP status code reference.