← All status codes5xx – Server Error

HTTP 504 – Gateway Timeout

The server, acting as a gateway or proxy, did not get a response in time from the upstream server.

Common use case

Occurs when a proxy or load balancer is up and the backend is technically alive, but the backend is just too slow to respond within the configured timeout - e.g. a slow database query.

Example

HTTP/1.1 504 Gateway Timeout

History

Part of HTTP/1.1 (RFC 2068, 1997).

Did you know?

It is distinct from 502: a 502 means the upstream sent garbage, while a 504 means the upstream never answered in time at all.