在 HTTP 协议中,响应状态码 412 Precondition Failed(先决条件失败)表示客户端错误,意味着对于目标资源的访问请求被拒绝。这通常发生于采用除 GETHEAD 之外的方法进行条件请求时,由首部字段 If-Unmodified-SinceIf-None-Match 规定的先决条件不成立的情况下。这时候,请求的操作——通常是上传或修改文件——无法执行,从而返回该错误状态码。

状态码

  1. 412 Precondition Failed(先决条件失败)

规范

SpecificationTitle
RFC 7232, section 4.2: 412 Precondition FailedHypertext Transfer Protocol (HTTP/1.1): Conditional Requests

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
412ChromeFull support YesEdgeFull support YesFirefoxFull support YesIEFull support YesOperaFull support YesSafariFull support YesWebView AndroidFull support YesChrome AndroidFull support YesEdge MobileFull support YesFirefox AndroidFull support YesOpera AndroidFull support YesSafari iOSFull support YesSamsung Internet AndroidFull support Yes

Legend

  • Full support
  • Full support

参见

文档标签和贡献者

标签:

此页面的贡献者:mdnwebdocs-bot, WayneCui, xgqfrms-GitHub, LangDonHJJ

最后编辑者:mdnwebdocs-bot,