504 Gateway Timeout
A gateway/proxy did not get a response from the upstream in time.
Common causes
- The proxy waited too long for the upstream: slow database query, hanging external API call
- The proxy timeout is shorter than the processing time
How to fix
- Optimise slow queries / work, move heavy jobs to background processing
- Raise the proxy timeout (proxy_read_timeout…) if really needed
Detailed reference (MDN) ↗RFC 9110 §15.6.5 ↗
Which code should I use?
- 502 / 504: Both come from a proxy / gateway. 502: the upstream server sent a bad response or refused the connection. 504: the upstream server was too slow (timed out).
