HTTP 状态码参考 - 完整状态码指南
免费在线 HTTP 状态码参考工具。搜索和浏览所有 HTTP 响应状态码,包含描述、分类和常见使用场景。
1xx Informational
The server has received the request headers and the client should proceed.
The server is switching protocols as requested (e.g., WebSocket upgrade).
2xx Success
The request succeeded. Standard response for successful HTTP requests.
The request succeeded and a new resource was created. Common after POST requests.
The request succeeded but there is no content to return. Common for DELETE.
The server is delivering only part of the resource due to a range header.
3xx Redirection
The resource has been permanently moved to a new URL. Use for SEO redirects.
The resource is temporarily at a different URL. Often used in OAuth redirects.
The resource has not been modified since the last request. Use cached version.
Like 302 but preserves the HTTP method. Used in HSTS redirects.
Like 301 but preserves the HTTP method.
4xx Client Error
The server cannot process the request due to invalid syntax or parameters.
Authentication is required. The client must provide valid credentials.
The client does not have permission to access the resource, even with auth.
The requested resource does not exist on the server.
The HTTP method is not supported for the requested resource.
The request conflicts with the current state of the resource.
The resource is permanently gone and will not be available again.
The request body exceeds the server limit.
The media type in the request is not supported by the server.
The request is well-formed but contains semantic errors (used in APIs).
The user has sent too many requests in a given time. Rate limiting.
5xx Server Error
Generic server error. Something unexpected went wrong.
The server received an invalid response from an upstream server.
The server is temporarily unable to handle the request (maintenance/overload).
The upstream server did not respond in time.
什么是 HTTP 状态码?
HTTP 状态码是 Web 服务器在响应客户端请求时返回的三位数字。它们指示请求是否成功、被重定向、导致客户端错误还是引起服务器错误。状态码分为五个类别:1xx(信息性)、2xx(成功)、3xx(重定向)、4xx(客户端错误)和 5xx(服务器错误)。理解这些状态码对于需要构建、调试和监控 Web 应用程序和服务的 Web 开发人员、API 设计者和系统管理员来说至关重要。
如何使用 HTTP 状态码参考
- 浏览按类别(1xx 到 5xx)组织的完整 HTTP 状态码列表。
- 使用搜索框按数字、名称或描述过滤状态码——例如,输入 '404' 或 'redirect'。
- 每个状态码显示其数字代码、官方名称以及何时和如何使用的简明描述。
- 颜色编码的类别使您能轻松区分成功(绿色)、重定向(黄色)、客户端错误(橙色)和服务器错误(红色)。
- 在调试 API 响应、配置 Web 服务器或编写错误处理逻辑时使用此参考。
常见使用场景
- API 开发 — 在设计 REST API 响应时选择正确的状态码——了解何时使用 201 而非 200,或 400 而非 422,有助于设计更好的 API。
- 调试 HTTP 错误 — 当 API 返回意外状态码时,快速查找其含义以了解问题出在客户端还是服务器端。
- SEO 与重定向 — 理解 301(永久)和 302(临时)重定向之间的区别及其对搜索引擎优化的影响。
- 错误页面设计 — 在实现 404、403、500 和其他常见错误场景的自定义错误页面时参考正确的状态码。