503 vs 504 Errors Explained: How nginx, AWS ALB, and Cloudflare Differ
HTTP 503 and 504 errors signal fundamentally different problems — availability versus latency — and diagnosing them correctly depends on which infrastructure layer is involved. In nginx, a 504 is triggered when the gap between successive reads from an upstream exceeds proxy_read_timeout, while 503s typically come from rate limiting or the application layer, never from a slow upstream. AWS ALB returns a 503 when no healthy targets exist in a target group, and a 504 when a healthy target fails to respond within the configurable idle timeout, which defaults to 60 seconds. Cloudflare uses its own 524 code when an origin connects via TCP but returns no HTTP response within roughly 100 seconds, reserving 503 for requests blocked by its own WAF or rate-limiting rules at the edge. Engineers troubleshooting these errors are advised to check target health and recent deployments for 503s, and to profile the slow operation itself before raising any timeout thresholds for 504s.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in