ApiSimul logo ApiSimul — the switchboard

HTTP 504 — Gateway Timeout

HTTP 504 is 502’s patient cousin: the gateway waited for the upstream, the upstream never answered in time, and the gateway gave up on the client’s behalf. The slow part is always behind the proxy.

When 504 shows up

Mocking a 504 response

A response with this status can be faked end to end with a local mock rule — no backend changes needed. The configuration below mirrors the rule fields the ApiSimul editor uses (method, path, status, delay in milliseconds, response body):

{
  "method": "GET",
  "path": "/api/reports/heavy",
  "status": 504,
  "delay": 1500,
  "enabled": true,
  "body": {
    "error": "gateway_timeout",
    "upstreamTimeoutMs": 1500
  }
}

Dynamic placeholders such as {{random.name}}, {{string.uuid}} or {{number.int 1 100}} can appear inside the body to vary each response, which keeps client-side list rendering and retry logic honest during development.

Frequently asked questions

What does HTTP 504 mean?
The gateway timed out waiting for the upstream service. The client may retry, but the underlying slowness needs an infrastructure fix.

How can I test a 504 response without a real backend?
Define a mock rule with the method and path your client requests and set the status to 504. The example configuration above returns this response after the listed delay, so the client exercises its 504 handling exactly as it would against a live server.

Related status codes

Need the response in your own project? Spin up rules for any status with the ApiSimul mock server, or browse every status code page.