Gateway Timeout — the gateway did not receive an upstream response in time
What 504 Means
The 504 error on the HTTP Status-Codes indicates gateway timeout — the gateway did not receive an upstream response in time. This typically occurs due to upstream application responds more slowly than the gateway timeout.
A 504 Gateway Timeout occurs when a gateway, proxy, or load balancer forwards the request upstream and then stops waiting because the upstream service did not respond fast enough. The edge server is reachable, but the dependency behind it did not produce a response within the allowed window. This makes 504 a classic multi-tier infrastructure error rather than a direct browser-to-origin parsing failure.
Technical Background
A 504 is generated by the server that sits between the client and the origin service. It successfully received the request, forwarded it, and then reached its timeout threshold before an upstream response came back.
That makes 504 different from both 502 and 408. A 502 suggests an invalid upstream response, while a 408 means the server never received the full client request in time. A 504 is specifically about an upstream response that arrived too late or not at all.
Common Causes
- Upstream application responds more slowly than the gateway timeout
- Database or dependency delays stall the backend response
- Load balancer timeout is shorter than request processing time
- Network interruption occurs between proxy and upstream service
Typical Scenarios
- A reverse proxy waits on an application server that becomes overloaded
- An API gateway reaches the backend, but the database query takes too long
- A load balancer times out while a slow upstream service is still processing
What to Know
A 504 often affects route groups or services that share the same upstream dependency. If only one endpoint returns 504, the slowdown may be isolated to a specific backend path. If many unrelated pages return it together, the likely issue is broader upstream saturation or dependency failure.
Frequently Asked Questions
Common questions about HTTP 504 error
A 502 usually means the gateway received an invalid response from upstream. A 504 means the gateway waited too long and did not receive a usable response before the timeout window ended.
Yes. It points to an upstream dependency or infrastructure path behind the gateway rather than to a malformed request coming from the client.
Different routes can depend on different upstream services, queries, or workloads. A timeout may affect only the path whose backend work runs too long under current conditions.