Link to home
Start Free TrialLog in
Avatar of Maarten Bruins
Maarten Bruins

asked on

Handling a Received Validation Request in case of multiple entity-tags?

My question is about this part of the HTTP/1.1 Caching protocol, see:
https://tools.ietf.org/html/rfc7234#page-17 (Handling a Received Validation Request)

A request containing an If-None-Match header field (Section 3.2 of
[RFC7232]) indicates that the client wants to validate one or more of
its own stored responses in comparison to whichever stored response
is selected by the cache.

When a cache decides to revalidate its own stored responses for a
request that contains an If-None-Match
list of entity-tags, the cache
MAY combine the received list with a list of entity-tags from its own
stored set of responses (fresh or stale) and send the union of the
two lists as a replacement If-None-Match header field value in the
forwarded request.

If the response to the forwarded
request is 304 (Not Modified) and has an ETag header field value with
an entity-tag that is not in the client's list, the cache MUST
generate a 200 (OK) response for the client by reusing its
corresponding stored response, as updated by the 304 response
metadata (Section 4.3.4).

Let's assume we have:

  • A browser cache.
  • A proxy cache.
  • An origin server.

The browser cache contains a stored stale resource with entity-tag "A". The proxy cache contains a stored stale resource with entity-tag "B". The proxy cache can act as a client, and as a server. The entity-tag of the resource on the origin server is also "A". In short:

A browser cache,	stale response,	entity-tag "A"
A proxy cache,	stale response,	entity-tag "B"
An origin server,	resource,	entity-tag "A"

Open in new window


This can for example be the case if you're just starting to use a proxy cache. According to the protocol, this will happen (if I see it right):

  1. The browser will send a conditional request with If-None-Match: "A".
  2. The proxy cache receives the conditional request.
  3. The proxy cache will forward this request. This is because the stored resource in proxy cache is stale. The two entity-tags ("A" and "B") will be combined. The new If-None-Match will contain both entity-tags.
  4. The origin server receives the request with entity-tags "A" and "B".

Now see:

if the
field-value is a list of entity-tags and at least one of them matches
the entity-tag of the selected stored response, a cache recipient
SHOULD generate a 304 (Not Modified) response

But this is about a cache recipient. What about an origin server? The protocol is unclear about this. For now I assume this is also the case for the origin server. In our case, "A" matches with "A" on the origin server. The origin server will respond with a 304 Not Modified status code. This response contains 1 entity-tag ("A").

Am I right, that the response in proxy cache will stay stale? The entity-tag "A" in the 304 response, does not match the entity-tag "B" of its stored response. But that makes the proxy cache useless? Then I would rather expect a 200 OK response, so at least the content in proxy cache will not be stale anymore.

How I have to see this? What will actually happen in practise?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.