412 Precondition Failed
The HTTP412 Precondition Failedclient error response status code indicates that access to the target resource was denied.This happens withconditional requests on methods other thanGET orHEAD when the condition defined by theIf-Unmodified-Since orIf-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.
In this article
Status
412 Precondition FailedExamples
>Precondition failed
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"ETag: W/"0815"Avoiding mid-air collisions
With the help of theETag and theIf-Match headers, you can prevent conflicts or mid-air collisions.For example, when editing some wiki pages, content is hashed and put into anETag in successful responses:
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"When saving changes to a wiki page (posting data), thePOST request will contain theIf-Match header containing theETag values that the client stored from the last edit to check freshness of the resource on the server:
If-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"If the hashes don't match, the document has been edited in-between and a412 Precondition Failed error is thrown.
Specifications
| Specification |
|---|
| HTTP Semantics> # status.412> |