HTTP 504 Gateway Timeout
Server ErrorA gateway/proxy didn't get a response from the upstream in time. The upstream may still be processing — the proxy just gave up waiting.
Defined in RFC 9110
Common causes
- Slow upstream work (long queries, external API calls) exceeding proxy timeout
- Network path problems between proxy and upstream
- Undersized connection pools causing queuing delays
How to fix it
Profile and speed up the slow upstream operation; add DB indexes
Move long work to async jobs (respond 202 + status URL)
Align timeout budgets: client > proxy > upstream
Check connectivity between the proxy and upstream
Related status codes
A gateway/reverse proxy got an invalid response from the upstream server — the proxy is fine, the thing behind it isn't answering properly.
408 Request TimeoutThe server gave up waiting for the client to finish sending the request. Servers often close the connection afterwards.
503 Service UnavailableThe server is temporarily unable to handle the request — overloaded, in maintenance, or deliberately shedding load. Retry-After may say when to come back.
Want to explore status codes interactively? Try the free HTTP Status Code Reference — search, categories and example responses, right in your browser.