HTTP 504 Gateway Timeout: What It Means and When You See It
Quick Answer
HTTP 504 Gateway Timeout means the server acting as a gateway did not receive a timely response from an upstream server. The upstream service is too slow or down.
Why HTTP 504 Occurs
HTTP 504 Gateway Timeout means a proxy or gateway did not receive a timely response from an upstream server. Common causes: upstream service is slow (heavy database query, external API taking too long), network partition between proxy and backend, upstream crashed without closing the connection, and cold start latency on serverless functions. The proxy has a timeout (default 60s for Nginx) - if the upstream does not respond within that time, 504 is returned.
Fixing HTTP 504 Errors
For Nginx: increase proxy_read_timeout (default 60s) if the upstream legitimately needs more time. Check if the upstream service is running and reachable. Add database query timeouts and optimize slow queries. For AWS ALB: check target group health and timeout settings. For Cloudflare Workers: functions have a 30s CPU time limit. For serverless (Lambda, Vercel): check function duration logs. Use async processing with a queue for operations that regularly exceed 30 seconds.
Try the interactive tool
Convert any value instantly — no sign-up required
Frequently Asked Questions
Related Values
100
HTTP 100 Continue means the server has received the request headers and the client should proceed to send the request body. It is an interim response used to inform the client to continue.
101
HTTP 101 Switching Protocols indicates the server is switching to the protocol specified in the Upgrade header field. Commonly used when upgrading to WebSocket connections.
200
HTTP 200 OK is the standard success response. The request has succeeded and the server has returned the requested resource in the response body.
201
HTTP 201 Created means the request succeeded and a new resource was created as a result. The Location header typically points to the new resource URL.