Understanding The Vary Header

Category: caching, Coding, headers



The Vary HTTP header is sent in billions of HTTP responses every day. But its use has never fulfilled its original vision, and many developers misunderstand what it does or don’t even realize that their web server is sending it. With the coming of the Client Hints, Variants and Key specifications, varied responses are getting a fresh start.

Illustration of content-negotiated conversation between user and bank

In principle, a URL represents not a web page, but a conceptual resource, like your bank statement. Imagine that you want to see your bank statement: You go to and send a GET request for /statement. So far so good, but you didn’t say what format you want the statement in. This is why your browser will also include something like Accept: text/html in your request. In theory, this means you could say Accept: text/csv instead and get the same resource in a different format.

The post Understanding The Vary Header appeared first on Smashing Magazine.