Examples 2 and 3 both use the Vary header in the response to the preflight request:
Vary: Origin
Could you clarify your decision to include that header in the response, as well as motivate its value (Origin)?
Although responses to OPTIONS requests are not supposed to be cached (outside browsers' preflight cache, of course), some questionable Web caches do allow users to cache such responses. In that case, it would make sense to specify a Vary header in responses to preflight requests.
However, in that case, shouldn't Access-Control-Request-Method, Access-Control-Request-Headers, and Access-Control-Request-Private-Network also be listed in the Vary header? Unless those three request headers do not affect the response, they would become part of the cache-poisoning attack surface if they're not listed in the Vary header.
Under the assumption that a Web cache is in place and caches responses to preflight requests, I would have expected
Examples 2 and 3 both use the
Vary
header in the response to the preflight request:Could you clarify your decision to include that header in the response, as well as motivate its value (
Origin
)?Although responses to
OPTIONS
requests are not supposed to be cached (outside browsers' preflight cache, of course), some questionable Web caches do allow users to cache such responses. In that case, it would make sense to specify aVary
header in responses to preflight requests.However, in that case, shouldn't
Access-Control-Request-Method
,Access-Control-Request-Headers
, andAccess-Control-Request-Private-Network
also be listed in theVary
header? Unless those three request headers do not affect the response, they would become part of the cache-poisoning attack surface if they're not listed in theVary
header.Under the assumption that a Web cache is in place and caches responses to preflight requests, I would have expected
Otherwise, I wouldn't expect the need for any
Vary
header at all.