2

Is there any reason for a HTTP server to sometimes respond with Vary: *, and sometimes with Vary: Foo, to requests for the same resource?

What should a cache do, if after receiving (and caching) both responses, it then receives a request with a matching Foo header, for which the Vary: Foo response is suitable? Can it serve the matching response, or does the separate Vary: * response override it?

mjs
  • 63,493
  • 27
  • 91
  • 122

2 Answers2

0

There may be a situation where a server can guarantee that for a certain time a resource's representation is only influenced by Foo but after some time have elapsed, it can no longer make any guarantee and must set the header to Vary: *.

Expiration is preferred over validation. Since Vary: * forces revalidation, the cache should select the Foo response assuming it is fresh.

Hans Malherbe
  • 2,988
  • 24
  • 19