Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. HTTP
  3. Reference
  4. HTTP response status codes
  5. 412 Precondition Failed

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.

Status

http
412 Precondition Failed

Examples

Precondition failed

http
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:

http
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:

http
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

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp