HTTP Vary Header
Determines how the response should be cached based on request headers. Ensures caches serve the correct version based on varying request criteria.
Purpose
Tells caches which request headers to consider when deciding whether to serve a cached response, enabling proper content negotiation.
Vary: * Vary: <header-name> Vary: <header-name>, <header-name> Example: Vary: Accept-Encoding Example: Vary: Accept-Language, User-Agent
Code Examples
See how to use the Vary header in different tools and languages.
Related Headers
Cache-Control
Specifies caching directives for both requests and responses. Controls how and for how long content is cached by browsers and intermediate caches.
Accept-Encoding
Indicates which content encoding (compression algorithm) the client supports. The server may compress the response body using one of these methods.
Accept-Language
Indicates which natural languages the client prefers. The server uses this for content negotiation to return the appropriate language version.
User-Agent
Identifies the client software making the request. Contains information about the application, operating system, and version.