About
The Vary 1) HTTP response header specifies header values that should be added to the cache key used by the cache.
Usage
Not mixing content for mobile vs desktop
A server may serve different contents for desktop or mobile depending on the user-agent header.
If the cache uses only the URL has cache key, a desktop page could be served to a mobile page.
To avoid this situation, you can add the user-agent header in the Vary header to instruct caching servers to add the user agent header to the cache key.
Vary: User-Agent
Security
If you don't want to serve the same page to different users.
Vary: Cookie
Set
The Vary header value should be the same:
- and a 200 OK response.