HTTPQUERY
English

HTTP 状态码

按类别浏览状态码。展开任意一行即可查看该状态码的真实 HTTP 报文示例。

1xx信息响应(Informational)

100Continue客户端应继续发送请求体。查看示例
→ REQUEST
                          
                              
                              POST /uploads HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Length: 5242880
                            
                              

                              Expect: 100-continue
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 100 Continue
                            
                              

                              
                            
                              

                              (client now streams the 5 MB body)
                            
                              

                              
                            
                              

                              HTTP/1.1 201 Created
                            
                              

                              Location: /uploads/8f2c
                            
                        
101Switching Protocols服务器同意切换协议(如升级到 WebSocket)。查看示例
→ REQUEST
                          
                              
                              GET /chat HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Upgrade: websocket
                            
                              

                              Connection: Upgrade
                            
                              

                              Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
                            
                              

                              Sec-WebSocket-Version: 13
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 101 Switching Protocols
                            
                              

                              Upgrade: websocket
                            
                              

                              Connection: Upgrade
                            
                              

                              Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
                            
                        
102Processing102 Processing 表示服务器已收到请求并正在处理,防止客户端在长时间处理期间超时。源自 WebDAV 规范。查看示例
→ REQUEST
                          
                              
                              GET /sample.pdf HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
103Early Hints103 Early Hints 允许服务器在最终响应到来之前发送预加载提示,让浏览器提前获取关键资源,加快页面加载速度。查看示例
→ REQUEST
                          
                              
                              GET /index.html HTTP/1.1
                            
                              

                              Host: example.com
                            
                        

2xx成功(Success)

200OK请求成功,响应含所请求的资源。查看示例
→ REQUEST
                          
                              
                              GET /products/42 HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 200 OK
                            
                              

                              Content-Type: application/json
                            
                              

                              Content-Length: 51
                            
                              

                              
                            
                              

                              { "id": 42, "name": "Trailhead Boot", "price": 189 }
                            
                        
201Created请求成功且创建了新资源。查看示例
→ REQUEST
                          
                              
                              POST /products HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "name": "Ridge Boot", "price": 210 }
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 201 Created
                            
                              

                              Location: /products/43
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "id": 43, "name": "Ridge Boot", "price": 210 }
                            
                        
202Accepted202 Accepted 表示请求已被接受但尚未处理完成,服务器将异步处理。客户端可通过轮询获取最终结果。查看示例
→ REQUEST
                          
                              
                              POST /job HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/xml
                            
                              

                              Content-Length: 68
                            
                              

                              
                            
                              

                              <?xml version="1.0"?>
                            
                              

                              <job>
                            
                              

                                <id>125</id>
                            
                              

                                <task>G01</task>
                            
                              

                              </job>
                            
                        
203Non-Authoritative Information203 Non-Authoritative Information 表示响应经过代理转换,内容已非源服务器原始返回。与 200 OK 的区别在于数据来源可能被修改。查看示例
→ REQUEST
                          
                              
                              GET /instructions HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
204No Content成功但无响应体。查看示例
→ REQUEST
                          
                              
                              DELETE /products/43 HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 204 No Content
                            
                              

                              
                            
                              

                              (no body)
                            
                        
205Reset Content205 Reset Content 告知客户端重置当前文档视图(如清空表单)。与 204 的区别在于 205 要求客户端主动重置输入状态。查看示例
→ REQUEST
                          
                              
                              POST /signup HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/xml
                            
                              

                              Content-Length: 92
                            
                              

                              
                            
                              

                              <?xml version="1.0"?>
                            
                              

                              <person>
                            
                              

                                <name>David Smith</name>
                            
                              

                                <country>USA</country>
                            
                              

                              </person>
                            
                        
206Partial Content206 Partial Content 表示服务器成功返回了 Range 请求指定的部分内容。支持断点续传、分片下载和流媒体传输。查看示例
→ REQUEST
                          
                              
                              GET /videos/sample.mp4 HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Range: bytes=25000-75000
                            
                        
207Multi-Status207 Multi-Status 用于 WebDAV,一次操作涉及多个资源时,每个资源的结果独立汇报。响应体为 XML 格式。查看示例
                          
                              
                              <d:response>
                            
                              

                                <d:href>http://example.re/tasks</d:href>
                            
                              

                                <d:status>HTTP/1.1 200 OK</d:status>
                            
                              

                              </d:response>
                            
                        
208Already Reported208 Already Reported 用于 WebDAV,在 207 多状态响应中避免重复列举已报告的资源,减少响应体积。查看示例
→ REQUEST
                          
                              
                              PROPFIND /main/ HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Depth: infinity
                            
                              

                              DAV: bind
                            
                              

                              Content-Type: application/xml; charset="utf-8"
                            
                              

                              Content-Length: 139
                            
                              

                              
                            
                              

                              <?xml version="1.0" encoding="utf-8" ?>
                            
                              

                              <d:propfind xmlns:d="DAV:">
                            
                              

                                <d:prop>
                            
                              

                                  <d:name/>
                            
                              

                                  <d:link/>
                            
                              

                                </d:prop>
                            
                              

                              </d:propfind>
                            
                        
226IM Used226 IM Used 表示服务器已返回资源的增量编码(delta encoding),通过只传输差异部分来节省带宽。实际使用较少。查看示例
→ REQUEST
                          
                              
                              GET /livingdocs/current_specs.pdf HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Accept-Encoding: gzip
                            
                        

3xx重定向(Redirection)

300Multiple Choices300 Multiple Choices 表示请求的资源有多个可选表示,客户端需自行选择其中一个。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
301Moved Permanently资源已永久移动到 Location 指向的地址。查看示例
→ REQUEST
                          
                              
                              GET /old-path HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 301 Moved Permanently
                            
                              

                              Location: https://example.com/new-path
                            
                        
302Found资源临时位于 Location。查看示例
→ REQUEST
                          
                              
                              GET /account HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 302 Found
                            
                              

                              Location: /login
                            
                        
303See Other303 See Other 用于在 POST/PUT/DELETE 后重定向到结果页面。客户端必须切换为 GET 请求。查看示例
→ REQUEST
                          
                              
                              DELETE /tasks/314 HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
304Not Modified缓存有效,可直接使用本地副本。查看示例
→ REQUEST
                          
                              
                              GET /logo.png HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              If-None-Match: "9c2e-abc123"
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 304 Not Modified
                            
                              

                              ETag: "9c2e-abc123"
                            
                              

                              
                            
                              

                              (no body — reuse the cached copy)
                            
                        
305Use Proxy305 Use Proxy 已被废弃,因安全原因(如可能被用于中间人攻击)被移除,不再推荐使用。查看示例
→ REQUEST
                          
                              
                              GET /document.pdf HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
307Temporary Redirect307 Temporary Redirect 表示资源临时位于另一地址。与 302 的区别在于 307 严格保持原请求方法不变。查看示例
→ REQUEST
                          
                              
                              GET /news.html HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
308Permanent Redirect308 Permanent Redirect 表示资源已永久迁移。与 301 的区别在于 308 保持原请求方法,搜索引擎会正确转移权重。查看示例
→ REQUEST
                          
                              
                              POST /api/v1/orders HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/json
                            
                              

                              Content-Length: 35
                            
                              

                              
                            
                              

                              {"item": "widget", "quantity": 10}
                            
                        

4xx客户端错误(Client Error)

400Bad Request请求语法或参数有误。查看示例
→ REQUEST
                          
                              
                              POST /products HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "price": "not-a-number" }
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 400 Bad Request
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "error": "price must be a number" }
                            
                        
401Unauthorized需要身份认证。查看示例
→ REQUEST
                          
                              
                              GET /account HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 401 Unauthorized
                            
                              

                              WWW-Authenticate: Bearer realm="api"
                            
                        
402Payment Required402 Payment Required 为保留状态码,目前无标准用法。Shopify、Stripe 等平台有非标准使用。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
403Forbidden已认证但无权限。查看示例
→ REQUEST
                          
                              
                              DELETE /users/1 HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Authorization: Bearer <valid-token>
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 403 Forbidden
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "error": "admin role required" }
                            
                        
404Not Found找不到目标资源。查看示例
→ REQUEST
                          
                              
                              GET /products/9999 HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 404 Not Found
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "error": "product 9999 not found" }
                            
                        
405Method Not Allowed该资源不支持所用方法。查看示例
→ REQUEST
                          
                              
                              DELETE /products HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 405 Method Not Allowed
                            
                              

                              Allow: GET, POST, QUERY
                            
                        
406Not Acceptable406 Not Acceptable 表示服务器无法提供满足 Accept 头要求的表示。需检查内容协商配置和 Accept 头。查看示例
                          
                              
                              Accept: text/html, text/plain
                            
                        
407Proxy Authentication Required407 Proxy Authentication Required 表示需要通过代理认证。客户端需在 Proxy-Authorization 头中提供凭据。查看示例
→ REQUEST
                          
                              
                              GET /documents/tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
408Request Timeout408 Request Timeout 表示服务器等待请求超时。通常因客户端发送过慢或网络问题导致连接被关闭。查看示例
→ REQUEST
                          
                              
                              PUT /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              Content-Length: 10000
                            
                        
409Conflict409 Conflict 表示请求与服务器当前状态冲突(如资源已存在或版本不一致)。常见于并发更新场景。查看示例
→ REQUEST
                          
                              
                              POST /blog/update?postid=111&flag=like HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
410Gone410 Gone 表示资源已被永久删除且不会恢复。与 404 的区别在于 410 明确告知资源曾经存在。查看示例
→ REQUEST
                          
                              
                              GET /holiday-promotion-Jan-2021.pdf HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
411Length Required411 Length Required 表示服务器要求请求携带 Content-Length 头。需在请求中明确指定消息体长度。查看示例
→ REQUEST
                          
                              
                              PUT /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              
                            
                              

                              <PDF file included as message body>
                            
                        
412Precondition Failed412 Precondition Failed 表示请求头中的条件判断失败(如 If-Match 的 ETag 不匹配)。用于防止丢失更新。查看示例
→ REQUEST
                          
                              
                              POST /blog/update?postid=111&task=reply HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              If-Unmodified-Since: Fri, 1 Jan 2021 00:00:00 GMT
                            
                              

                              Content-Type: text/plain
                            
                              

                              Content-Length: 45
                            
                              

                              
                            
                              

                              <Message body contains reply-text from the client>
                            
                        
413Content Too Large413 Content Too Large 表示请求体超过服务器允许的大小限制。需减小上传内容或调整服务器配置。查看示例
→ REQUEST
                          
                              
                              PUT /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              Content-Length: 10000
                            
                        
414URI Too Long414 URI Too Long 表示请求 URI 超过服务器允许的最大长度。应改用 POST body 或缩短查询参数。查看示例
→ REQUEST
                          
                              
                              GET /<...a_long_URI...> HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
415Unsupported Media Type415 Unsupported Media Type 表示服务器无法处理请求体的媒体类型。需检查 Content-Type 是否正确。查看示例
→ REQUEST
                          
                              
                              POST /blog/newmessage HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: text/plain
                            
                              

                              Content-Length: 24
                            
                              

                              
                            
                              

                              Good morning, Everybody!
                            
                        
416Range Not Satisfiable416 Range Not Satisfiable 表示请求的字节范围超出资源实际大小。需检查 Range 头的范围值。查看示例
                          
                              
                              Content-Range: bytes */512
                            
                        
417Expectation Failed417 Expectation Failed 表示 Expect 头中的条件无法满足。服务器不支持 100-continue 机制时返回此码。查看示例
→ REQUEST
                          
                              
                              PUT /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              Content-Length: 10000
                            
                              

                              Expect: 100-continue
                            
                        
418I'm a teapot我是茶壶——RFC 2324 的彩蛋状态码。查看示例
→ REQUEST
                          
                              
                              BREW /coffee HTTP/1.1
                            
                              

                              Host: teapot.example
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 418 I'm a teapot
                            
                              

                              Content-Type: text/plain
                            
                              

                              
                            
                              

                              I refuse to brew coffee — I am a teapot.
                            
                        
421Misdirected Request421 Misdirected Request 表示请求被路由到了无法处理的服务器。常见于 HTTP/2 连接复用或 Alt-Svc 配置问题。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/2
                            
                              

                              Host: example.com
                            
                        
422Unprocessable Content422 Unprocessable Content 表示请求格式正确但语义有误(如字段验证失败)。与 400(语法错误)和 415(类型错误)不同。查看示例
→ REQUEST
                          
                              
                              POST /requests HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/xml
                            
                              

                              Content-Length: 101
                            
                              

                              
                            
                              

                              <?xml version="1.0" encoding="utf-8"?>
                            
                              

                              <request>
                            
                              

                                 <id>100</id>
                            
                              

                                 <action>start</action>
                            
                              

                              </request>
                            
                        
423Locked423 Locked 表示目标资源被锁定(WebDAV)。需使用 Lock-Token 头解锁或等待锁过期。查看示例
→ REQUEST
                          
                              
                              PUT /documents/ HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              Content-Length: 10000
                            
                              

                              
                            
                              

                              <PDF file transferred>
                            
                        
424Failed Dependency424 Failed Dependency 表示前序请求失败导致当前操作无法执行(WebDAV)。需检查依赖操作的结果。查看示例
→ REQUEST
                          
                              
                              PROPPATCH /update.html HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/xml; charset="utf-8"
                            
                              

                              Content-Length: 305
                            
                              

                              
                            
                              

                              <?xml version="1.0" encoding="utf-8" ?>
                            
                              

                              <d:propertyupdate xmlns:d="DAV:"
                            
                              

                                                xmlns:z="urn:example">
                            
                              

                                <d:set>
                            
                              

                                  <d:prop>
                            
                              

                                    <z:seats>
                            
                              

                                      <z:seatnumber>100</z:seatnumber>
                            
                              

                                      <z:seatnumber>101</z:seatnumber>
                            
                              

                                    </z:seats>
                            
                              

                                  </d:prop>
                            
                              

                                  <d:prop>
                            
                              

                                    <d:name>Smith</d:name>
                            
                              

                                  </d:prop>
                            
                              

                                </d:set>
                            
                              

                              </d:propertyupdate>
                            
                        
425Too Early425 Too Early 表示服务器不愿处理可能不安全的早期数据(TLS 0-RTT),以防止重放攻击。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Early-Data: 1
                            
                        
426Upgrade Required426 Upgrade Required 表示服务器要求客户端升级协议。需在 Upgrade 头中指定新协议(如 HTTP/2、TLS)。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
428Precondition Required428 Precondition Required 表示服务器要求请求携带条件头(如 If-Match),以防止并发更新导致的丢失更新问题。查看示例
→ REQUEST
                          
                              
                              PUT /reservations.txt HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
429Too Many Requests请求过于频繁,被限流。查看示例
→ REQUEST
                          
                              
                              GET /api/search HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 429 Too Many Requests
                            
                              

                              Retry-After: 30
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "error": "rate limit exceeded" }
                            
                        
431Request Header Fields Too Large431 Request Header Fields Too Large 表示单个或总请求头过大。需精简 Cookie 或减小头部大小。查看示例
→ REQUEST
                          
                              
                              GET /tech-news HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Cookie: first_cookie=<very_long>; second_cookie=<long_again>
                            
                        
451Unavailable For Legal Reasons451 Unavailable For Legal Reasons 表示因法律要求(如版权、审查)无法提供该资源。查看示例
→ REQUEST
                          
                              
                              GET /tech-trial-updates HTTP/1.1
                            
                              

                              Host: example.com
                            
                        

5xx服务器错误(Server Error)

500Internal Server Error服务器内部错误。查看示例
→ REQUEST
                          
                              
                              GET /report HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 500 Internal Server Error
                            
                              

                              Content-Type: application/json
                            
                              

                              
                            
                              

                              { "error": "unexpected server error" }
                            
                        
501Not Implemented501 Not Implemented 表示服务器不支持该请求方法。与 405 的区别在于 405 是支持该方法但不允许用于此资源。查看示例
→ REQUEST
                          
                              
                              POST /requests?id=111&flag=start HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
502Bad Gateway网关从上游收到无效响应。查看示例
→ REQUEST
                          
                              
                              GET /api/users HTTP/1.1
                            
                              

                              Host: gateway.example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 502 Bad Gateway
                            
                              

                              Content-Type: text/plain
                            
                              

                              
                            
                              

                              upstream sent an invalid response
                            
                        
503Service Unavailable服务暂时不可用(过载或维护)。查看示例
→ REQUEST
                          
                              
                              GET / HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
← RESPONSE
                          
                              
                              HTTP/1.1 503 Service Unavailable
                            
                              

                              Retry-After: 120
                            
                              

                              Content-Type: text/plain
                            
                              

                              
                            
                              

                              under maintenance — try again shortly
                            
                        
504Gateway Timeout504 Gateway Timeout 表示网关或代理未在规定时间内收到上游服务器的响应。需检查上游服务状态和超时配置。查看示例
→ REQUEST
                          
                              
                              GET /news HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
505HTTP Version Not Supported505 HTTP Version Not Supported 表示服务器不支持请求所用的 HTTP 版本。需降级到服务器支持的版本。查看示例
→ REQUEST
                          
                              
                              GET / HTTP/2
                            
                              

                              Host: example.com
                            
                        
506Variant Also Negotiates506 Variant Also Negotiates 表示透明内容协商出现循环引用,通常是服务器配置错误导致。查看示例
→ REQUEST
                          
                              
                              GET /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Accept: text/html, application/xhtml+xml
                            
                        
507Insufficient Storage507 Insufficient Storage 表示服务器存储空间不足,无法完成操作(WebDAV)。与 413 的区别在于 507 是服务端存储问题。查看示例
→ REQUEST
                          
                              
                              PUT /docs HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Content-Type: application/pdf
                            
                              

                              Content-Length: 10000
                            
                              

                              
                            
                              

                              <PDF file included in message body>
                            
                        
508Loop Detected508 Loop Detected 表示服务器在处理请求时检测到无限循环(WebDAV)。需检查资源引用关系。查看示例
→ REQUEST
                          
                              
                              PROPFIND /shared/ HTTP/1.1
                            
                              

                              Host: example.com
                            
                              

                              Depth: infinity
                            
                              

                              Content-Type: application/xml
                            
                        
510Not Extended510 Not Extended 与已废弃的 HTTP Extension Framework 相关,实际中几乎不再使用。查看示例
→ REQUEST
                          
                              
                              GET /resource HTTP/1.1
                            
                              

                              Host: example.com
                            
                        
511Network Authentication Required511 Network Authentication Required 表示需要网络认证(如 Wi-Fi 热点的强制门户登录页面)。查看示例
→ REQUEST
                          
                              
                              GET / HTTP/1.1
                            
                              

                              Host: example.com