Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this configuration in apache mean? [closed]

Header append Vary User-Agent env=!dont-vary

Can anyone give a detailed explanation for this?

like image 533
omg Avatar asked Jun 09 '09 15:06

omg


2 Answers

This uses Apache mod_headers to append the value "User-Agent" to the Vary HTTP header, but only if the dont-vary environment is not set.

But what is the Vary header? See RFC2616 which says

The Vary field value indicates the set of request-header fields that fully determines, while the response is fresh, whether a cache is permitted to use the response to reply to a subsequent request without revalidation

If you deliver different HTML markup depending on the User-Agent header, you might use a Vary header with User-Agent in it to ensure that a caching proxy didn't serve content intended for browser X to browser Y.

like image 142
Paul Dixon Avatar answered Oct 28 '22 01:10

Paul Dixon


See the Header directive in the mod_headers documentation.

This instructs the web server to append the new value of the Vary header to any previous value of the Vary header (separating the new value from the old one by a comma) or to create a new value for the Vary header. The new value to be created or appended will be user-agent. This header will only be created/appended if the dont-vary environment variable is undefined within the environment of the executing apache service.

To summarize, if the dont-vary environment variable does not exist, the server will issue out something like this:

Vary: ...,user-agent
like image 23
Dathan Avatar answered Oct 27 '22 23:10

Dathan