HTTP - Vary Header


The Vary HTTP response header permits to add a header value to the cache key used by the cache.


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


If you don't want to serve the same page to different users.

Vary: Cookie


The Vary header value should be the same:

Powered by ComboStrap