The conditional-write boundary
An HTTP conditional request carries a test that the origin evaluates before it carries out the requested action. For a state-changing request using If-Match, a false test means the origin must not apply that method. This provides a protocol mechanism for avoiding an older editor overwriting a concurrent editor’s work.
Think of the validator as evidence about one selected representation, rather than a general statement that a resource name exists. After a successful state-changing request, a response ETag can describe the replacement representation and can later be used as a validator.
This is a conditional-write contract for an origin server. Before relying on it, verify that each target endpoint evaluates If-Match, produces suitable strong ETags, and documents its failure response.
Choose a strong representation validator
A tag list in If-Match succeeds when at least one supplied tag strongly matches the ETag of the representation selected by the server. Strong comparison concerns identical representation data, so a weak tag marked with W/ cannot satisfy this precondition.
The wildcard form has a different purpose. If-Match: * evaluates true when a current representation exists at the origin; it evaluates false when none exists. It therefore checks existence, not whether the caller still has the version it previously read.
| Situation | Evidence retained | Documented condition outcome | Bounded application-owned next step |
|---|---|---|---|
| Matching strong ETag | The strong tag received with the edited representation | A listed tag that strongly matches the selected representation makes the condition true. | Submit the intended change and retain any returned replacement validator. |
| Stale strong ETag | The earlier strong tag and the unsaved draft | If no listed tag matches, the condition is false; the requested method is not performed, and a 412 response is permitted. | Keep the draft; begin the proposed review path rather than replacing its validator silently. |
| Weak ETag | The received weak-tag marker and draft | A weak entity tag cannot pass the strong comparison required by If-Match. | Obtain an appropriate strong validator before offering a representation-specific save. |
| Wildcard with a current representation | The request used the wildcard and the operation context | The wildcard condition is true when the origin has a current target representation. | Use this only where existence is the application’s intended condition. |
| Wildcard with no current representation | The wildcard request and absence outcome | The wildcard condition is false when the origin lacks a current target representation. | Handle the result under the application’s chosen missing-resource policy. |
| Conflict review after 412 | The draft, prior validator, response status, and a newly fetched version if available | For an unsatisfied If-Match condition on a non-GET or non-HEAD request, 412 identifies a failed precondition. | Proposed policy: preserve, fetch, compare, ask for review, then resubmit only with newly obtained evidence. |
A hypothetical two-editor timeline
Illustrative scenario: editors A and B each read a document carrying the same strong ETag, then A saves a revision first. B later sends its retained tag with a conditional save. If A’s save changed the selected representation so B’s tag no longer matches, B’s method is blocked; B keeps its unsaved draft for the review path.
This is a hypothetical sequence, not an observed API result. Its relevant protocol premise is that state-changing conditional requests can prevent parallel clients from accidentally replacing one another’s changes.
Handle failure without inventing a merge
A 412 response is a useful signal that the relevant condition was not met for a modification-style request. It does not itself define the user interface, a content merge, or an authorization decision. Preserve the local draft and make fetch, compare, reviewer choice, and resubmission explicit proposed application policy.
There is an important response ambiguity: when a state-changing request appears already reflected in the selected representation, RFC 9110 allows a successful 2xx response even though the ordinary failed-precondition path can use 412. Treat that case as a separate product decision and collect endpoint-specific evidence before retry or conflict handling.
Limits and alternatives
Representation-specific optimistic concurrency is the preferred choice when a save must correspond to the exact version the editor saw. Existence-only wildcard checking is a viable alternative when the application merely requires a current representation, but it cannot detect that a caller’s previously viewed version is stale.
The recovery workflow described here is an article proposal, not a provider-prescribed implementation. It does not establish endpoint support, merge behavior, authorization, persistence, or a universal status-code contract. Confirm the target API’s representation selection, ETag strength, conditional-write behavior, and already-applied-operation handling.
What is the durable recovery boundary for this workflow? Consider a client that receives
412, fetches the current representation, and then crashes before the unsaved draft, prior ETag, fetched version, and review state are committed together. On restart, a cached draft paired with the newly fetched ETag could be presented as though it had been reviewed against that version, even though the comparison never completed.RFC 9110 establishes that a false
If-Matchcondition prevents the requested method from being performed, but it does not make the client-side draft or review transition durable. Could the proposed policy require an observable recovery record containing the draft, rejected validator, response status, and identifier/validator of the fetched comparison version, with restart behavior that returns to “comparison required” unless that record is complete? A reproducible crash test at each transition—after412, after fetch, and after review selection—would show that recovery neither loses the draft nor silently resubmits it using evidence that was never actually reviewed.