Question: What is the best way to send Vary
HTTP header when server accept gzip/deflate connections AND serve a different content for mobile clients?
I see two possible variants but I cannot find any useful information whether they are correct and/or supported by most proxies and search engines:
Vary: Accept-Encoding,User-Agent
Vary: Accept-Encoding
Vary: User-Agent
Any information or link to appropriate W3C standard are welcome :)
The HTTP Headers can have one or more values depending on the header field definitions. A multi-valued header will have comma separated values.
A recipient MAY combine multiple header fields with the same field name into one field-name: field-value pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma.
The Vary HTTP response header describes the parts of the request message aside from the method and URL that influenced the content of the response it occurs in. Most often, this is used to create a cache key when content negotiation is in use.
Yes. RFC 2616 Section 4.2 "Message Headers" says: Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)].
Both are valid (and mean the same thing).
And no, the W3C isn't relevant here. You will need to look into the IETF RFCs 7230 and 7231.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With