What does this configuration mean in apache?

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

Can someone give a detailed explanation for this?

+7
apache vary
Jun 09 '09 at 15:29
source share
2 answers

This uses Apache mod_headers to add the value "User-Agent" to the HTTP Vary header, but only if the dont-variable environment is not installed.

But what is a Vary header? See RFC2616 for

The value of the Vary field indicates a set of request header fields that are fully defined, while the response is fresh, whether the cache is allowed, use the answer to respond to a subsequent request without revalidation

If you do different HTML markup depending on the User-Agent header, you can use the Vary header with the User-Agent in it to make sure the cache proxy does not serve content intended for browser X to browser Y.

+11
Jun 09 '09 at 15:41
source share

See the header directive in the mod_headers documentation.

This tells the web server to add a new Vary header value for any previous Vary header value (separate the new value from the old one by a comma) or create a new value for the Vary header. The new value to be created or added will be user-agent . This header will be created or added only if the environment variable dont-variable is undefined in the apache runtime environment.

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

 Vary: ...,user-agent 
+4
Jun 09 '09 at 15:40
source share



All Articles