503 vs 504: Service Unavailable vs Gateway Timeout
503 and 504 can look similar in logs, but they tell clients, crawlers, and API consumers different things.
| Aspect | 503 | 504 |
|---|---|---|
| Meaning | Service Unavailable describes how the server processed the request and what the client should do next. | Gateway Timeout describes how the server processed the request and what the client should do next. |
| Typical use case | HTTP 503 Service Unavailable indicates a server errors response outcome. | HTTP 504 Gateway Timeout indicates a server errors response outcome. |
| Caching/client behavior | Check cache headers and downstream behavior for 503. | Check cache headers and downstream behavior for 504. |
| SEO implications | Search crawlers interpret 503 according to server-errors semantics. | Search crawlers interpret 504 according to server-errors semantics. |
| API/backend impact | API clients may branch logic specifically on 503. | API clients may branch logic specifically on 504. |
When to use one vs the other
Use 503 when the response should communicate service unavailable behavior; use 504 when gateway timeout is the accurate protocol signal.
A frequent mistake is swapping 503 and 504 for convenience; that causes client retry bugs, incorrect cache signals, and misleading monitoring data.
Decision summary: if user agents should receive the Service Unavailable signal, return 503; if they should receive Gateway Timeout, return 504.
FAQ
What is the biggest difference between 503 and 504?
503 communicates Service Unavailable, while 504 communicates Gateway Timeout. Choosing the right one keeps clients and intermediaries predictable.
Do 503 and 504 have SEO or caching impact?
Yes. Search engines and caches interpret status classes differently. Use each code according to its semantics to avoid accidental indexing, stale responses, or crawl inefficiency.
Can APIs safely return 503 instead of 504?
Only when it matches contract semantics. API clients often branch logic by exact code, so swapping them can break retries, auth handling, or user-facing errors.
Related guides: 503 Service Unavailable ยท 504 Gateway Timeout