Loading...
Loading...
免费的在线 HTTP 状态码参考手册——浏览和搜索所有 HTTP 响应状态码及描述。
The server has received the request headers and the client should proceed to send the body.
The requester has asked the server to switch protocols.
Standard response for successful HTTP requests.
The request has been fulfilled and a new resource is created.
The server successfully processed the request but is not returning any content.
The requested resource has been permanently moved to a new URL.
The requested resource resides temporarily under a different URL.
The resource has not been modified since the last request.
The server cannot process the request due to client error.
Authentication is required and has failed or not been provided.
The server understood the request but refuses to authorize it.
The requested resource could not be found.
The request method is not supported for the requested resource.
The server timed out waiting for the request.
The user has sent too many requests in a given amount of time.
A generic error message when the server encounters an unexpected condition.
The upstream server returned an invalid response.
The server is temporarily unable to handle the request.
The upstream server failed to respond in time.
HTTP 状态码是服务器响应客户端请求时返回的三位数字。它们是 HTTP/1.1 标准(RFC 7231)的一部分,并根据第一位数字分为五个类别。每个代码传达了关于请求结果的特定含义,帮助开发和运维团队理解和诊断 Web 服务行为。
1xx(信息响应)代码表示服务器已收到请求并正在继续处理。这些是客户端应用程序很少看到的临时响应。最常见的是 101 Switching Protocols,用于升级到 WebSocket 连接时。
2xx(成功响应)代码表示请求已成功接收、理解并被接受。最熟悉的是 200 OK,这是成功 HTTP 请求的标准响应。201 Created 表示已创建新资源(常见于 REST API),而 204 No Content 用于请求成功但不返回主体内容时,如 DELETE 操作。
3xx(重定向)代码告诉客户端需要进一步操作才能完成请求。301 Moved Permanently 和 302 Found 用于 URL 重定向,301 表示资源已永久移动(搜索引擎会更新索引),302 表示临时移动。304 Not Modified 通过告诉客户端缓存的版本仍然有效来实现高效缓存。
4xx(客户端错误)代码表示请求包含错误语法或服务器无法完成请求。400 Bad Request 涵盖格式错误的请求,401 Unauthorized 需要身份验证,403 Forbidden 表示服务器理解请求但拒绝授权,而 404 Not Found 是网络上最广为人知的错误代码。429 Too Many Requests 在限流 API 中越来越常见。
5xx(服务器错误)代码表示服务器未能完成有效请求。500 Internal Server Error 是用于意外服务器条件的通用错误码。502 Bad Gateway 表示上游服务器返回了无效响应。503 Service Unavailable 表示服务器暂时过载或停机维护。504 Gateway Timeout 表示上游服务器未及时响应。
401 Unauthorized 意味着客户端必须进行身份验证(登录)才能访问资源。403 Forbidden 意味着服务器理解了身份验证但已认证的用户没有访问该资源的权限。401 可以通过登录解决;403 无法由当前用户解决。
502 Bad Gateway 表示服务器(作为网关或代理)从上游服务器收到了无效响应。这通常发生在 Web 服务器(nginx)无法连接到应用服务器(Node.js、Python)或应用程序崩溃时。它通常是暂时的,刷新后可能恢复正常。
404 错误对任何公共网站都是正常的——它们可能由链接失效、用户输入 URL 错误或自动扫描器探测漏洞引起。然而,特定路径的 404 突然增加可能表明配置问题、重定向失效或恶意扫描活动。