HTTP Status Codes

HTTP 504 Gateway Timeout

504
HighWeb ServerReference page

Gateway Timeout — the gateway did not receive an upstream response in time

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.

Visual summary

A quick reference view of how HTTP 504 works: A proxy server holding an expiring stopwatch while the connection to the backend server fails to respond.

HTTP 504 visual summary showing a proxy server holding an expiring stopwatch while the connection to the backend server fails to respond.
Visual summary: 504 means a gateway or proxy timed out waiting for an upstream server.

What 504 Means

The shortest useful reading of this status code.

Gateway Timeout means the gateway did not receive an upstream response in time.

This status falls into the 5xx class, indicating a server-side error outcome for the request.

Quick read

Gateway Timeout

the gateway did not receive an upstream response in time

Technical Context

How this status behaves without turning the page into a repair guide.

Standard usage

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.

Technical nuance

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.

Related HTTP Codes

Nearby HTTP status codes help clarify how 504 differs inside the same response family.

Common Causes

Upstream application responds more slowly than the gateway timeout

A common condition that triggers a 504 response when the web server evaluates the transaction.

Database or dependency delays stall the backend response

A common condition that triggers a 504 response when the web server evaluates the transaction.

Load balancer timeout is shorter than request processing time

A common condition that triggers a 504 response when the web server evaluates the transaction.

Network interruption occurs between proxy and upstream service

A common condition that triggers a 504 response when the web server evaluates the transaction.

Typical Scenarios

01

A reverse proxy waits on an application server that becomes overloaded

02

An API gateway reaches the backend, but the database query takes too long

03

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 interpretation questions about HTTP 504.

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.