httpcachingproxyrfc2616vary

Is there ever any reason to respond with "Vary: *" and "Vary: Foo" for the same resource?


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?


Solution

  • Each response is evaluated in isolation, so it can select the Vary: Foo response.

    See: