Vary Is Not a Privacy Boundary for Authenticated Responses
An HTTP cache can save bandwidth and reduce latency, but it also makes decisions about which request may reuse a stored response. The Vary response header tells caches which request header fields contributed to the response. RFC 9111 requires a cache to avoid reusing a stored response unless the nominated header fields match the original request, or the cache revalidates the response. That is a correctness rule for content negotiation. It is not a promise that a shared cache will protect private data.
A common mistake is to vary on Accept-Encoding or User-Agent while forgetting the cookie or authorization context that produced the body. If a response contains a personalized account panel and the cache key does not include the relevant identity, a second request can receive the first user's body. Adding Vary: Cookie can reduce the risk in some deployments, but it is a blunt instrument.…