Why should caches and intermediaries ignore If-Match?

RFC 7232 Section 3.1 says:

> The If-Match header field can be ignored by caches and intermediaries
> because it is not applicable to a stored response.

RFC 7234 Section 4.3.2 says the same thing:

> The If-Match ... conditional header fields are not applicable to a cache.

Why?

Suppose the client sends a GET request with If-Match: "A". This request is
first sent to an HTTP cache. Suppose the requested resource is cached, and
suppose the cache ignores the If-Match header as suggested above. If the
cache has version "B" cached, not version "A", the cache will return a 2xx
with ETag: "B". This behavior is surprising and seems to contradict the
following statement from RFC 7232 Section 3.1:

> [If-Match] can also be used with safe
> methods to abort a request if the selected representation does not
> match one already stored (or partially stored) from a prior request.

I am trying to use If-Match for exactly this reason.

I understand why a cache would not generate 412s. The cache is not
authoritative for the resource and 412 implies authority. But, it seems
like the cache should never respond with an ETag that is disallowed by
If-Match, and if the cache does not have an allowed ETag, then the request
should be forwarded to the origin. Does that sound right?

Received on Wednesday, 15 February 2017 23:43:48 UTC