The HyperText Transfer Protocol (HTTP)
412 Precondition Failed client error response code indicates that access to the target resource has been denied. This happens with conditional requests on methods other than
HEAD when the condition defined by the
If-None-Match headers is not fulfilled. In that case, the request, usually an upload or a modification of a resource, cannot be made and this error response is sent back.
412 Precondition Failed
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4" ETag: W/"0815"
With the help of the
ETag and the
If-Match headers, you can detect mid-air edit collisions.
For example, when editing MDN, the current wiki content is hashed and put into an
Etag in the response:
If the hashes don't match, it means that the document has been edited in-between and a
Precondition Failed error is thrown.
|RFC 7232, section 4.2: 412 Precondition Failed||Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests|
The information below has been pulled from MDN's GitHub (https://github.com/mdn/browser-compat-data).
© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.