HTTP Error Code 504
A gateway or proxy did not receive a timely response from an upstream server.
A gateway or proxy did not receive a timely response from an upstream server.
| Code | 504 |
| Product | HTTP |
| Company / origin | IETF / IANA · International standard |
| Category | Protocols & Standards |
| Platform / versions | HTTP/1.1, HTTP/2, HTTP/3 · All HTTP versions |
| Severity | error |
| Official source | RFC 9110: HTTP Semantics ↗ |
| Last verified | 2026-11-08 |
What does HTTP error 504 mean?
HTTP 504 means the gateway waited for the upstream and gave up before a response arrived. The upstream may still be processing the request, which is why retrying a non-idempotent operation can be risky.
Common causes
- A slow database query or downstream API exceeded the gateway timeout.
- The upstream is overloaded or blocked on a lock.
- The network path between the gateway and upstream is slow or unstable.
How to fix it
- Step 1
Measure the upstream latency and identify the slow dependency.
- Step 2
Raise the gateway timeout only after confirming the upstream can finish within it.
- Step 3
For non-idempotent requests, check the result before retrying to avoid duplicate side effects.
When to escalate
Related codes
| Code | Name | What it means |
|---|---|---|
408 | Request Timeout | The client did not send the full request within the server's timeout. |
502 | Bad Gateway | A gateway or proxy received an invalid response from an upstream server. |
400 | Bad Request | The server cannot process the request because the syntax or parameters are invalid. |
401 | Unauthorized | Authentication is missing, expired, or invalid. |
403 | Forbidden | The server understood the request but refuses to authorize it. |
Source & verification
This page was checked against RFC 9110: HTTP Semantics on 2026-11-08. The code, product, and platform fields are kept separate from the explanation so corrections can be made without changing the URL.
Open Error Codes is independent and not affiliated with IETF / IANA. Always confirm destructive or security-sensitive steps with the official documentation.