HTTP 412 Precondition Failed
HTTP 412 Precondition Failed means a condition in the request evaluated to false at the server. A typical write uses If-Match to ensure it applies only to the version the client previously read.
Fetch the new version before trying again
Suppose your client submits an update using an older ETag and the server returns 412. Retrieve the latest representation, reconcile the user’s change and submit with the current validator if the update still makes sense.
Check whether the proxy changed the validator
Compare the response ETag on the original read with the If-Match received by the application. If an intermediary transformed or cached the response, verify that the validator corresponds to the representation the server uses for writes. A server requiring a condition that was absent can return 428.
Walk through an ETag update
Imagine GET /drafts/17 returns ETag: "draft-7". Another editor saves a change, and the current tag becomes "draft-8". A PUT sent with If-Match: "draft-7" can return 412 because the editor started from an older copy. Retrieve version 8, check what changed and reconcile your update before resubmitting with the new validator. Your client should still handle another 412 if someone saves a newer version while you work.
Preserve the condition when tracing the proxy path
Record the destination, ETag from the read, If-Match from the write and both response status codes. If you operate a caching intermediary, check whether the read was served from a stale copy, then obtain a fresh representation using the API’s normal rules. If the backend sees a tag different from the one sent by the client, inspect header forwarding and representation changes at the gateway. Removing the condition could allow an update to overwrite another editor’s work. Keep the concurrency check in place as you fix the data path.