Understanding The Vary Headeradmin
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.
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
bank.com 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.