The HTTP Vary header lists the other HTTP headers that were used to create the current representation.
The HTTP Vary header is used to keep track of other HTTP headers that were relied upon to generate the current representation. For example, consider a resource that is available in HTML format by default. In this case, the client requests the resource in
text/plain instead of
text/html. This is done using the HTTP Accept header, as follows:
Because the HTTP Accept header causes a non-default representation of the resource to be generated, the HTTP Accept header is relevant to its recreation and is therefore included in HTTP Vary, as follows:
This is important because shared caches have to understand what HTTP headers, encodings, and other operations have been applied to the resource.
The HTTP Vary header is used to keep track of the headers that were relevant in the generation of the response.