An upstream server did not respond in time. The failure is in the chain behind the endpoint, not at the endpoint itself.
Test what your own timeout does when it is shorter than the gateway's — you will get a client-side abort rather than the 504, and your logs will disagree with theirs.
1 endpoint in this playground answers with 504. Every one is free, needs no signup, and can be called from the browser or with curl.
GET https://funapi.dev/api/protocol/v1/gateway-timeout — Always, after ~3 seconds. Pair it with a 2s client timeout. (Protocol Lab API)All HTTP status codes · All 37 mock REST APIs · Getting started guide