What is the difference between 502, 503 and 504?
502 Bad Gateway means a proxy got an invalid response from the upstream. 503 Service Unavailable means the server is temporarily unable to handle the request, such as overload or maintenance. 504 Gateway Timeout means the proxy gave up waiting on the upstream. Together they tell you whether the upstream broke, is overloaded, or is slow.
Answered in
HTTP Status Codes You Misuse, and What to Return Instead401 vs 403, 301 vs 308, 404 vs 410, 502 vs 503 vs 504. Picking the right status code tells clients and monitors what to do next.
Read the full analysisOther questions this article answers
More development best practices questions
- What is the primary security vulnerability of storing JWTs in localStorage?
- How do server-side sessions scale horizontally across multiple instances?
- Why is immediate revocation nearly impossible with stateless JWTs?
- What is the recommended modern authentication architecture for SaaS apps?
- What is the N+1 query problem in GraphQL and how is it fixed?
- How does GraphQL Federation allow multiple backend teams to maintain one API?
- Why is caching harder in GraphQL than in traditional REST APIs?
- When should an engineering team prefer REST or gRPC over GraphQL?
Every answer on Crashtech is written by the editor of the article it comes from — never auto-summarised. Browse all answers or the Development Best Practices beat.