Skip to content

5xx Server error

504 Gateway Timeout

A proxy or gateway didn't get a response from the server in time.

What 504 means

The load balancer or CDN waited for the application server and gave up. The server may still be working on (and may complete) your request.

Common causes

  • A slow database query or upstream API call.
  • An endpoint that does too much work per request.
  • Network problems between the proxy and the server.

How to fix it

If you're calling an API

  • Retry with backoff, but be careful with non-idempotent requests: the first one may have succeeded.
  • Ask for smaller pages or narrower queries.

If you run the server

  • Speed up the endpoint, raise proxy timeouts, or move slow work to a background job (202 + polling).

Should you retry?

Yes for idempotent requests; check before retrying writes.

Example response

HTTP
HTTP/1.1 504 Gateway Timeout
Content-Type: application/problem+json

{
  "type": "about:blank",
  "title": "Gateway Timeout",
  "status": 504,
  "detail": "A proxy or gateway didn't get a response from the server in time."
}

Defined in: RFC 9110 (HTTP Semantics). 504 is a server error: the problem is on the server's side.

Debugging an API call? Convert your request with the cURL converter, check the response with the JSON formatter, or see whether the API is down on its status page.

Often confused with

HTTP 504 FAQ

What does HTTP 504 mean?

504 Gateway Timeout: A proxy or gateway didn't get a response from the server in time. The load balancer or CDN waited for the application server and gave up. The server may still be working on (and may complete) your request.

Is 504 a client or server error?

It's a server error (5xx): the server failed to handle a valid request, so the fix is usually on the server's side.

How do I fix a 504 error?

Retry with backoff, but be careful with non-idempotent requests: the first one may have succeeded. Ask for smaller pages or narrower queries.

Should I retry after a 504?

Yes for idempotent requests; check before retrying writes.

Other 5xx status codes

All HTTP status codes