Vary and gzip

Andreas Plesner Jacobsen apj at
Thu Jul 19 22:50:13 CEST 2012

While trying to reproduce #1172, I've realized what a mess Vary and gzip really

In the concrete case, presented in #1172, I believe the reporter is wrong that
his backend is correct, it doesn't seem to send Vary: Accept-Encoding for
non-gzip requests.

However, I've used varnish for compressing uncached content coming from an IIS
In this case, the IIS will never compress, and therefore doesn't send "Vary:
Accept-Encoding". But I set beresp.do_gzip, and would expect to see a proper
Vary for the response.

Which cases would it be reasonable to expect varnish to make sure that a proper
Vary: Accept-Encoding is sent?

My expections are:
* When the backend does support gzip and sends proper Vary, the client should
get Vary: Accept-Encoding for both gzip and non-gzip reqs. This works today.

* When the backend does support gzip, but doesn't send Vary on non-gzip
requests. Varnish should fix the Vary header as part of the gzip support.
I don't believe this works today.

* When the backend doesn't support gzip, but beresp.do_gzip is set, varnish
should add the proper Vary as part of the gzip support.
This doesn't work today.

Am I being unreasonable in my expectations? Are there scenarios I haven't


More information about the varnish-dev mailing list