The 504 Gateway Timeout status code indicates that a server acting as a gateway or proxy did not receive a timely response from an upstream server. This error commonly appears in distributed systems where multiple servers communicate with each other.
HTTP status code 504 belongs to the 5xx category, which represents server-side errors. The gateway waits for a response within a configured timeout window. If the upstream server exceeds this duration, the gateway aborts the request and returns 504.
// Example HTTP response showing a 504 status code
HTTP/1.1 504 Gateway Timeout
Content-Type: text/html
Connection: close
// Node.js Express example simulating a delayed upstream service
app.get("/api/data", (req, res) => {
setTimeout(() => {
res.send("Response from upstream service");
}, 10000);
});
If the gateway timeout is configured to 5 seconds and the upstream service responds after 10 seconds, the client receives a 504 Gateway Timeout instead of the actual data.
Adjust the sliders to see how the timeout limit affects the request outcome. If the upstream response takes longer than the timeout limit, a 504 occurs.