Name

Vary

Synopsis

The Vary header is used by servers to inform clients what headers from a client’s request will be used in server-side negotiation.[10] Its value is a list of headers that the server looks at to determine what to send the client as a response.

An example of this would be a server that sends special HTML pages based on your web browser’s features. A server sending these special pages for a URL would include a Vary header that indicated that it looked at the User-Agent header of the request to determine what to send as a response.

The Vary header also is used by caching proxies; see Chapter 7 for more on how the Vary header relates to cached HTTP responses.

Type

Response header

Basic Syntax

Vary: (“*” | 1# field-name)

Example

Vary: User-Agent

[10] See Chapter 17 for more on content negotiation.

Get HTTP: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.