If-Match Header Explained

What the HTTP If-Match header does and when it's used.

Published October 17, 2026

If-Match makes a request conditional on the resource's current ETag matching, used to prevent lost updates on PUT and DELETE.

How it works

If the ETag differs, the server returns 412 Precondition Failed.

The If-Match header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
If-Match: "v3"
Where If-Match appears.

Practical examples

The header

If-Match: "v3"

Set or use it in code

fetch('/docs/7', { method: 'PUT', headers: { 'If-Match': etag }, body })

Inspect it

curl -sI https://example.com | grep -i 'if-match'

Common mistakes

  • Ignoring it on the server
  • Using weak ETags
  • Not handling the 412 in the client

Key takeaways

  • If-Match: If-Match makes a request conditional on the resource's current ETag matching, used to prevent lost updates on PUT and DELETE.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

If-Match vs If-None-Match?

If-Match proceeds only on a match; If-None-Match only on a mismatch.

Is If-Match case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles