503 Service Unavailable

HTTP 503 服务不可用 服务器错误响应状态码表示服务器尚未准备好处理请求。

常见的原因是服务器停机维护或过载。在维护期间,服务器管理员可能会暂时将所有流量路由到 503 页面,或者这可能会在软件更新期间自动发生。在过载情况下,当达到内存、CPU 或连接池限制等资源阈值时,一些服务器端应用程序将拒绝带有 503 状态的请求。丢弃传入请求会产生背压,防止服务器的计算资源耗尽,从而避免更严重的故障。如果由于速率限制而限制来自特定客户端的请求,则适当的响应是429 请求过多

此响应应用于临时情况,并且 Retry-After HTTP 标头应尽可能包含服务恢复的估计时间。

此响应应附带一个解释问题的用户友好页面。

注意:随此响应发送的缓存相关标头需要特别注意;503 表示临时问题,响应通常不应缓存,因为客户端在修复部署后可能会收到过时的错误页面。

状态

http
503 Service Unavailable

示例

503 服务器错误响应

以下请求尝试获取一个网页,但收到 503 响应。响应正文包含一个描述服务器状态的页面,其中包含指向访问者支持页面的链接。响应正文中包含一个标识符,用于说明一种可能有助于服务器管理员缩小问题根本原因的方法。

http
GET /highlights HTTP/1.1
Host: example.com
User-Agent: curl/8.6.0
Accept: */*
http
HTTP/1.1 503 Service Unavailable
Content-Type: text/html;
Content-Length: 123

<!doctype html>
<html lang="en">
<head>
  <title>503 Service Unavailable</title>
</head>
<body>
  <h1>503 Service Unavailable</h1>
  <p>The server was unable to complete your request. Please try again later.</p>
  <p>If this problem persists, please <a href="https://example.com/support">contact support</a>.</p>
  <p>Server logs contain details of this error with request ID: ABC-123.</p>
</body>
</html>

规范

规范
HTTP 语义
# status.503

另见