what does this configuration in apache mean?

11,307

Solution 1

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.

Solution 2

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
Share:
11,307

Related videos on Youtube

omg
Author by

omg

Updated on June 04, 2022

Comments

  • omg
    omg almost 2 years
    Header append Vary User-Agent env=!dont-vary
    

    Can anyone give a detailed explanation for this?