Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that nginx includes a Vary: Accept-Encoding header in some cases regardless of the file types I specify via "gzip_types".

I do not have much experience with nginx. Does it in fact send Vary: Accept-Encoding headers depending on the requesting User-Agent header?

Also, is there a setting (or combination of settings) that can be modified in order to stop nginx from sending Vary: Accept-Encoding headers for specific User-Agents?

There seem to be quite a few settings and I simply do not know which take precedence.

I suppose something like the following would not achieve what I want (I still want the Vary: Accept-Encoding response for file types only):
gzip_disable "*";

share|improve this question
up vote 1 down vote accepted

I don't understand why you'd want to change this. Vary: tells any caching proxy that it can not rely purely on the URL to cache the result and that it also needs to take into account of the Accept-Encoding: header too. This is the correct behaviour. You are going to get a different response if your client says it can deal with compressed responses or not. Without this header, a cache may attempt to send a compressed response to a client that can't handle it.

share|improve this answer
I do understand the Vary header's function and that of Accept-Encoding, however, I am trying to work around a bug and for the time being I need to be able to send the Vary:Accept-Encoding header only for certain file types and can re-implement the User-Agent functionality at a later date -- but I don't know how to disable it in the first place. – Structure Oct 20 '09 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.