Find out why your server is turning requests away
503 Service Unavailable means the server can't handle the request right now because it's overloaded or down for maintenance, a condition that should clear after a while. Servers can send it on purpose: during a deploy, from a maintenance mode, or when they hit a memory, CPU or connection limit and start refusing work. If the 503s don't line up with maintenance you planned, find what's using up the server's capacity.
Why a server sends a 503
Planned maintenance
A maintenance mode or deploy script routes every request to a 503 page until the work finishes. If the script fails before switching back, the site stays down.
Overload protection
When memory, CPU or a connection pool reaches its limit, some servers refuse new requests with a 503 instead of failing under the load.
No servers behind the load balancer
A load balancer with no registered or ready servers has nowhere to send the request, so it answers 503 itself and your app never logs it.
A rate limit using the wrong code
A limit on single clients should answer 429 Too Many Requests. A limiter that sends 503 makes one busy client look like an outage.
RFC 9110 defines 503 as temporary overload or scheduled maintenance. MDN describes servers that reject requests at memory, CPU or connection pool limits and says rate limits should use 429. Amazon's load balancer guide lists target groups with no registered targets as a cause of its 503s.
See who sends the 503 and when it started
# Print the status, the server that answered, and the Retry-After and Cache-Control headers
curl -sS -o /dev/null -D - https://yoursite.com/ | grep -iE '^(HTTP|server|retry-after|cache-control)'
# Count 503s per minute in the access log (combined log format)
awk '$9 == 503 {print substr($4, 2, 17)}' access.log | uniq -c | tail -n 30
Send a 503 the right way during maintenance
A 503 tells browsers, caches and crawlers the outage is temporary. Add a
Retry-Afterheader with a number of seconds or a date, which RFC 9110 says indicates how long the service is expected to be unavailable, and send a short page that tells people what's going on.Keep the 503 out of caches. MDN warns that a cached 503 can keep reaching visitors after the fix is deployed, so send
Cache-Control: no-storewith it.Keep it short for Google. Googlebot retries 503 URLs for about two days, and URLs still returning it after that drop out of the index, according to Google's crawling troubleshooting guide. Leave
robots.txtanswering normally the whole time, since Google's guide to pausing a site says a 503 on that file blocks all crawling.
How to fix a 503 Service Unavailable error
- Rule out maintenance firstLook for a maintenance flag, a deploy still running or a notice from your host. A maintenance mode left on after a failed deploy is the quickest 503 to fix.
- Match the 503s to loadLine up the minutes with the most 503s against traffic, memory, CPU and database connection graphs. The one that peaks at the same time shows which limit the server hit.
- Find what used up the capacityA traffic spike, an aggressive bot, a slow query holding connections or a memory leak each fill the server in a different way. Fix that cause before adding capacity, or the new capacity fills up the same way.
- Check the servers behind the load balancerIf the load balancer sends the 503, make sure at least one server is registered and passing its health check, and find out why the others dropped out.
- Send 429 for rate limitsIf the 503s come from a limiter on single clients, change it to answer 429 Too Many Requests so the status says what happened.
Frequently asked questions
Should a maintenance page return 503 or 200?
Return 503 for maintenance that lasts up to a day or two. A maintenance page sent with 200 tells crawlers that page is your content: Google's HTTP status code guide says it considers 2xx content for indexing and flags pages that look like errors as soft 404s. For 1 to 2 days, Google's guide to pausing a site says to send an informational page with a 503 and a Retry-After header. For a longer closure, it suggests a placeholder home page served with 200 instead.
Why doesn't my app's log show the 503s?
Because something in front of the app sent them. A load balancer with no healthy servers, a CDN or a host's platform layer can answer 503 before the request reaches your code. Check the Server header on the response, then look for the 503s in each layer's log, starting from the outside.
Keep your site up and crawlable
- Website reliabilityHear about it when your site goes down, not days later from a customer.
- 500 Internal Server ErrorFind the logged error behind the 500, then fix the code, configuration or permission that caused it.
- 504 Gateway TimeoutFind the request or server that's too slow for your proxy's timeout, then speed it up or move the work out of the request.
- Server error (5xx)Find what made your server fail Googlebot's requests and fix it before Google drops the pages.