what does this configuration in apache mean? [closed]
Asked Answered
L

2

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

Can anyone give a detailed explanation for this?

Lukelukens answered 9/6, 2009 at 15:29 Comment(0)
G
11

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.

Gooch answered 9/6, 2009 at 15:41 Comment(0)
C
4

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
Clavicorn answered 9/6, 2009 at 15:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.