HTTP 状态码参考
从 100 Continue 到 511 Network Authentication Required 的 60+ 标准 HTTP 响应码,每条附一行概要、RFC 引用、推荐用法,以及对常被误用的码(401 vs 403、301 永久缓存、400 vs 422 等)的「陷阱」提示。按分类(1xx 信息、2xx 成功、3xx 重定向、4xx 客户端、5xx 服务器)过滤,或在码值、名称、概要、备注中全文搜索。
结果数: 61
100ContinueServer received headers; client should send the body.
RFC: RFC 9110 §15.2.1
101Switching ProtocolsServer agrees to switch protocols (e.g., HTTP/2, WebSocket).
使用时机: WebSocket upgrade handshakes.
RFC: RFC 9110 §15.2.2
102ProcessingWebDAV: request received but no response yet.
RFC: RFC 2518
103Early HintsPreload hints sent before the final response.
使用时机: Send Link: rel=preload for critical assets before the slow backend reply lands.
RFC: RFC 8297
200OKStandard success response with a body.
RFC: RFC 9110 §15.3.1
201CreatedResource was created; include Location header pointing to it.
使用时机: POST that creates a new resource. Body is optional.
RFC: RFC 9110 §15.3.2
202AcceptedRequest accepted for async processing; no result yet.
使用时机: Long-running jobs — return a status URL for the client to poll.
RFC: RFC 9110 §15.3.3
203Non-Authoritative InformationResponse was transformed by a proxy.
RFC: RFC 9110 §15.3.4
204No ContentSuccess but no body to send.
使用时机: DELETE success, PUT with no useful body, preflight OK.
陷阱: MUST NOT include a message body. Some libraries error if you do.
RFC: RFC 9110 §15.3.5
205Reset ContentSuccess; client should reset the document view (clear form).
RFC: RFC 9110 §15.3.6
206Partial ContentRange request was honored; partial body follows.
使用时机: Resumable downloads, video seek.
RFC: RFC 9110 §15.3.7
207Multi-StatusWebDAV multi-resource batched results.
RFC: RFC 4918
208Already ReportedWebDAV: bindings already enumerated earlier in the response.
RFC: RFC 5842
226IM UsedDelta encoding response.
RFC: RFC 3229
300Multiple ChoicesMultiple resources match; client should pick one.
RFC: RFC 9110 §15.4.1
301Moved PermanentlyResource has a new permanent URL. Caches forever.
使用时机: Domain migration, URL restructure.
陷阱: Browsers cache 301 aggressively — fixing a wrong one is painful. Test with 302 first.
RFC: RFC 9110 §15.4.2
302FoundTemporary redirect (legacy semantics, method may change).
陷阱: Historically rewrote POST→GET. Use 303 or 307 for explicit method-preservation semantics.
RFC: RFC 9110 §15.4.3
303See OtherRedirect that always becomes a GET.
使用时机: POST/Redirect/GET pattern after form submit.
RFC: RFC 9110 §15.4.4
304Not ModifiedConditional request: cached copy is still fresh.
使用时机: Response to If-None-Match / If-Modified-Since.
陷阱: MUST NOT include a body.
RFC: RFC 9110 §15.4.5
307Temporary RedirectTemporary; method and body must be preserved.
RFC: RFC 9110 §15.4.8
308Permanent RedirectPermanent; method and body must be preserved.
使用时机: POSTs that must survive a permanent move. Prefer over 301 for API endpoints.
RFC: RFC 9110 §15.4.9
400Bad RequestGeneric malformed request the server cannot parse.
陷阱: Don't use 400 for valid syntax with bad semantics — use 422 instead.
RFC: RFC 9110 §15.5.1
401UnauthorizedAuthentication required or failed. Must include WWW-Authenticate.
陷阱: Misnamed historically — means "unauthenticated". Use 403 for "authenticated but not allowed".
RFC: RFC 9110 §15.5.2
402Payment RequiredReserved for future use; some APIs use for billing failures.
RFC: RFC 9110 §15.5.3
403ForbiddenAuthenticated but the action is not allowed for this principal.
使用时机: Authorization failure, geo-block, or "you cannot do this regardless of auth".
RFC: RFC 9110 §15.5.4
404Not FoundResource does not exist (or you are hiding it).
使用时机: Often returned instead of 403 to avoid disclosing existence.
RFC: RFC 9110 §15.5.5
405Method Not AllowedResource exists but does not support this verb. MUST include Allow header.
RFC: RFC 9110 §15.5.6
406Not AcceptableNo representation matches the Accept headers.
RFC: RFC 9110 §15.5.7
407Proxy Authentication RequiredLike 401 but for proxies. Must include Proxy-Authenticate.
RFC: RFC 9110 §15.5.8
408Request TimeoutServer gave up waiting for the request to finish.
RFC: RFC 9110 §15.5.9
409ConflictRequest collides with current state (e.g., edit conflict, duplicate).
使用时机: Unique-key violations on creation, version mismatch on update.
RFC: RFC 9110 §15.5.10
410GoneResource permanently removed with no forwarding address.
使用时机: Use over 404 when you want crawlers/clients to drop the URL permanently.
RFC: RFC 9110 §15.5.11
411Length RequiredServer requires Content-Length and the request omitted it.
RFC: RFC 9110 §15.5.12
412Precondition FailedIf-Match / If-Unmodified-Since check failed.
使用时机: Optimistic concurrency control on updates.
RFC: RFC 9110 §15.5.13
413Content Too LargeBody exceeds the server limit. Formerly "Payload Too Large".
RFC: RFC 9110 §15.5.14
414URI Too LongURL exceeds server limit (commonly ~8KB).
RFC: RFC 9110 §15.5.15
415Unsupported Media TypeContent-Type is not supported by this endpoint.
RFC: RFC 9110 §15.5.16
416Range Not SatisfiableRange header asks for bytes outside the resource.
RFC: RFC 9110 §15.5.17
417Expectation FailedServer cannot meet the Expect: header requirements.
RFC: RFC 9110 §15.5.18
418I'm a teapotApril-fools status (RFC 2324). Returned by some debugging or honeypot endpoints.
RFC: RFC 2324
421Misdirected RequestRequest was routed to a server that cannot produce a response (e.g., wrong SNI).
RFC: RFC 9110 §15.5.20
422Unprocessable ContentSyntactically valid but semantically incorrect (e.g., validation failure).
使用时机: Form-level validation errors on a JSON API.
RFC: RFC 9110 §15.5.21
423LockedWebDAV: resource is locked.
RFC: RFC 4918
424Failed DependencyWebDAV: a previous request in the chain failed.
RFC: RFC 4918
425Too EarlyServer refuses replay-vulnerable early data (TLS 1.3 0-RTT).
RFC: RFC 8470
426Upgrade RequiredClient must upgrade to a different protocol. Include Upgrade header.
RFC: RFC 9110 §15.5.22
428Precondition RequiredServer requires the request to be conditional (If-Match etc).
使用时机: APIs that demand optimistic-concurrency tokens to prevent lost updates.
RFC: RFC 6585
429Too Many RequestsRate-limited. Include Retry-After header.
RFC: RFC 6585
431Request Header Fields Too LargeSum of headers exceeds the server limit.
RFC: RFC 6585
451Unavailable For Legal ReasonsBlocked due to legal demand (Fahrenheit 451 reference).
RFC: RFC 7725
500Internal Server ErrorUnhandled exception or generic server crash.
陷阱: Never expose stack traces — log them server-side only.
RFC: RFC 9110 §15.6.1
501Not ImplementedServer does not support the requested method at all.
RFC: RFC 9110 §15.6.2
502Bad GatewayUpstream returned an invalid response to the gateway.
使用时机: Load balancer cannot reach origin; origin returned junk.
RFC: RFC 9110 §15.6.3
503Service UnavailableServer temporarily down or overloaded. Should include Retry-After.
RFC: RFC 9110 §15.6.4
504Gateway TimeoutGateway gave up waiting for upstream.
RFC: RFC 9110 §15.6.5
505HTTP Version Not SupportedServer does not support the HTTP version in the request.
RFC: RFC 9110 §15.6.6
506Variant Also NegotiatesTransparent content negotiation is misconfigured.
RFC: RFC 2295
507Insufficient StorageWebDAV: server cannot store the representation.
RFC: RFC 4918
508Loop DetectedWebDAV: infinite loop while processing.
RFC: RFC 5842
510Not ExtendedFurther extensions required to fulfill the request.
RFC: RFC 2774
511Network Authentication RequiredCaptive portal: log in to the network first.
使用时机: Public Wi-Fi splash pages.
RFC: RFC 6585
使用方法
- 在搜索框输入代码、名称或任意词(例如「redirect」「rate limit」「422」)。
- 可用彩色标签按分类过滤。
- 查看每条结果的概要、使用时机、陷阱以及 RFC 引用。
常见问题
- 为什么有些码会标「陷阱」?
- 少数状态码长期被误用。401 实际是「未认证」却常被理解为「未授权」;301 在浏览器里几乎永久缓存;400 vs 422 争议不止。陷阱标注只列出在代码评审与复盘中真正会咬人的具体情况。
- 包含 WebDAV 码吗?
- 包含 — 102、207、208、423、424、507、508 及其 RFC。即便你不直接用 WebDAV,库或代理偶尔会返回,了解一下含义有用。
- 厂商自定义码(Cloudflare 520-527 等)呢?
- 厂商专用码(Cloudflare 520-527、AWS 460/463、IIS 440)不在内 — 它们不属于任何 RFC,含义因厂商而异,请查相应厂商文档。
- 为什么有些码没有「使用时机」?
- 若代码语义在名称上已自明(200 OK、500 Internal Server Error),或仅出现在特殊场景,概要足矣。只有当确实有值得提醒之处时才显示 when / pitfall。
相关工具
JSON Diff 查看器
结构化对比两个 JSON——精确显示新增、删除、变更的字段。
Cache-Control 头构建器
通过可视化清单构建 HTTP Cache-Control 头 — 新鲜度、再验证、不可变性以及常用预设。
HTTP Basic 认证编码器/解码器
把 `用户名:密码` 编码成 Base64 `Authorization: Basic` 头 —— 或粘贴一个现有头查看里面是谁。
HTTP 头部参考
约 50 个标准 HTTP 请求、响应、CORS、缓存、安全、Cookie 头部的可搜索参考。
HTTP 方法参考
每个 HTTP 方法(GET、POST、PUT、DELETE、PATCH 等)的快速卡片 — 安全性、幂等性、可缓存性,以及是否允许请求/响应体。
/.well-known/* URI 参考
IANA 注册的 well-known URI 可搜索目录 — `security.txt`、`openid-configuration`、`apple-app-site-association`、`acme-challenge` 加 30+ 更多,附 RFC 参考和用例。