412 Precondition Failed
The 412 Precondition Failed HTTP status code indicates the requested action was not performed because a conditional test failed. This typically indicates the resource changed since the previous request to this resource, and the client should re-request the representation and try again.
Writing responses (origin servers)
If the request contains an If-Unmodified-Since
or If-Match
headers, parse each header header and return 412 Precondition Failed
if the condition fails. The response payload may be a document describing the reasons for failure, the new state of the resource, and/or changes to the resource since the client's copy.
If the client is attempting to perform a safe request and the server merely needs to indicate there's no changes, without indicating an error, see 304 Not Modified instead.
Reading responses (user agents)
A 412 Precondition Failed
indicates the resource changed between the last cache update and this request. The client needs to update the representation available, re-apply the changes, and try again.
See If-Unmodified-Since and If-Match for guidence on making these requests.
Overview table
- Name
- 412
- Message
- 412 Precondition Failed
- Description
- The conditional request failed.
- Specification
- RFC 7232: HTTP/1.1 Conditional Requests ยง4.2. 412 Precondition Failed
Example
HTTP/1.1 412 Precondition Failed
Content-Type: text/plain
The resource is currently at version 5.