@http · HTTP status codes, explained HTTP/1.1 504 Gateway Timeout ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5xx · Server error A proxy timed out waiting for upstream. WHAT IT MEANS ──────────────────────────────────────────────────────────── A gateway or proxy didn't get a response from the upstream server in time. Compared with 502: the upstream didn't answer badly, it didn't answer at all before the proxy gave up. WHY YOU'RE SEEING IT ───────────────────────────────────────────────────── → Slow database queries or long reports. → An upstream that's overloaded or stuck. → Proxy timeouts set lower than the app's real response time, such as nginx's 60-second proxy_read_timeout default. → Cloudflare uses its own code, 524, when your origin takes too long. HOW TO FIX IT ──────────────────────────────────────────────────────────── → Find what's slow on the upstream and optimise it. → Move long work to a background job and return 202. → Only raise proxy timeouts if the slow request is expected. EXAMPLE RESPONSE ───────────────────────────────────────────────────────── HTTP/1.1 504 Gateway Timeout Content-Type: text/html  

504 Gateway Time-out

 related 502 Bad Gateway   408 Request Timeout   503 Service Unavailable spec RFC 9110 §15.6.5 https://www.rfc-editor.org/rfc/rfc9110#section-15.6.5 web https://athttp.com/504 ← curl athttp.com/503 curl athttp.com/505 →