开发者

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

开发者 https://www.devze.com 2023-01-12 04:28 出处:网络
Is there any reason for a HTTP server to sometimes respond with Vary: *, and sometimes with Vary: Foo, to requests 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 shoul开发者_C百科d 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?


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

See:

  • https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p6-cache.html#constructing.responses.from.caches
  • https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p6-cache.html#caching.negotiated.responses


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号