DD
DevDash

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

Open tool →

Frequently Asked Questions

Related Values

Want API access + no ads? Pro coming soon.