504 Gateway Timeout β
Meaning β
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server. Essentially, the upstream server failed to send a request in time.
When to Use β
When a server is acting as a proxy or gateway and a request to the upstream takes too long or times out, so the intermediary gives up waiting and returns this error to the client.
Example β
A CDN or reverse proxy tries to call an API service, but the API is slow and doesnβt respond within the timeout window; the client receives 504 Gateway Timeout from the proxy indicating the upstream took too long.
When Not to Use β
Do not use if your server is not a gateway or proxy. If your own server's processing times out internally, you might still use 503 or a custom scheme. 504 is specifically for timeouts in communication with another server.
Source β
RFC 9110