503 Service Unavailable
HTTP response status code 503 Service Unavailable is a server error message that is returned when the HTTP request cannot be completed because the page or resource is unavailable, and the problem is assumed to be temporary.
Usage
When the 503 Service Unavailable status code is received, the server is unable to fulfill the HTTP request for an otherwise unspecified reason. It may be that the server is overloaded with a sudden surge of traffic, the resource is locked, the server is rebooting, there is a misconfiguration in the firewall settings or a host of other problems that are usually temporary.
Some sites will return the 503 Service Unavailable status code during site maintenance, which is the recommended way to ensure that search rankings are not affected by the maintenance.
In the case where the server is aware of the problem, such as a locked or overburdened resource, it can optionally include the Retry-After HTTP header to inform the client as to when to resubmit the HTTP request.
Note
When a web-crawler such as Googlebot receives the 503 Service Unavailable status code, it will assume that the server has a temporary problem. As such, it will take note, check the URI at a later time again and the search rankings are not affected. However if a site is down for an extended period of time, e.g. longer than a few days, and returns a 503 Service Unavailable status code during this period, search engines such as Google will assume the site is permanently offline and all search rankings disappear until the site has been fully restored and re-crawled by Googlebot without encountering the server errors.
Example
In the example, the client requests a resource and the server responds with a 503 Service Unavailable because the resource is temporarily unavailable. In the HTTP response, the Retry-After HTTP header is included to suggest that the HTTP request be resubmitted after 30 minutes.
Request
GET /latest_quotes HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 503 Service Unavailable
Content-Type: text/html; charset=UTF-8
Content-Length: 178
Retry-After: 1800
<html>
<head>
<title>Resource Busy<\title>
</head>
<body>
<p>Your request cannot be completed at this time. Please try again after 30 minutes.</p>
</body>
</html>
Code references
.NET
HttpStatusCode.ServiceUnavailable
Rust
http::StatusCode::SERVICE_UNAVAILABLE
Rails
:service_unavailable
Go
http.StatusServiceUnavailable
Symfony
Response::HTTP_SERVICE_UNAVAILABLE
Python3.5+
http.HTTPStatus.SERVICE_UNAVAILABLE
Java
java.net.HttpURLConnection.HTTP_UNAVAILABLE
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_SERVICE_UNAVAILABLE
Angular
@angular/common/http/HttpStatusCode.ServiceUnavailable
Takeaway
The 503 Service Unavailable status code is a server error that is returned when a HTTP request cannot be completed due to an unavailable resource and is assumed to be temporary.