HTTP · Gateway Timeout

HTTP Error Code 504

A gateway or proxy did not receive a timely response from an upstream server.

errorLast verified 2026-11-08RFC 9110: HTTP Semantics
Quick answer

A gateway or proxy did not receive a timely response from an upstream server.

Code504
ProductHTTP
Company / originIETF / IANA · International standard
CategoryProtocols & Standards
Platform / versionsHTTP/1.1, HTTP/2, HTTP/3 · All HTTP versions
Severityerror
Official sourceRFC 9110: HTTP Semantics ↗
Last verified2026-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

  1. Step 1

    Measure the upstream latency and identify the slow dependency.

  2. Step 2

    Raise the gateway timeout only after confirming the upstream can finish within it.

  3. Step 3

    For non-idempotent requests, check the result before retrying to avoid duplicate side effects.

When to escalate

Before you escalate: If the same status persists after you have checked the request, the server logs, and the upstream service, contact the API or hosting provider with the full response headers, request ID, timestamp, and a minimal reproduction.

Related codes

CodeNameWhat it means
408Request TimeoutThe client did not send the full request within the server's timeout.
502Bad GatewayA gateway or proxy received an invalid response from an upstream server.
400Bad RequestThe server cannot process the request because the syntax or parameters are invalid.
401UnauthorizedAuthentication is missing, expired, or invalid.
403ForbiddenThe 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.