Is there a way to change the IIS compression module so that it does not put in Vary: Accept-Encoding in the Response Headers? I would rather it put in Vary: * or do nothing and let me put that value in myself...
It is allowing the cache to serve up different cached versions of the page depending on whether or not the browser requests GZIP encoding or not. The vary header instructs the cache to store a different version of the page if there is any variation in the indicated header.
To check this Accept-Encoding in action go to Inspect Element -> Network check the request header for Accept-Encoding like below, Accept-Encoding is highlighted you can see.
It means the client can accept a response which has been compressed using the DEFLATE algorithm. https://en.wikipedia.org/wiki/Deflate This algorithm is also used in gzip compression format.
gzip. A format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC. This is the original format of the UNIX gzip program. The HTTP/1.1 standard also recommends that the servers supporting this content-encoding should recognize x-gzip as an alias, for compatibility purposes. compress.
This issue is now addressed by an official patch to IIS. To download and further info, visit http://support.microsoft.com/kb/2877816
Erez Benari, IIS PM
Ok, apparently the IIS compression module forces the Vary header to be Accept-Encoding no matter what, so caching becomes tricky. For pages with authentication this is bad, because it will not detect that it's different based on the user cookie. I ended up rolling my own compression in my controller and everything works fine now.
My suggestion- only use IIS static compression, don't use dynamic compression and instead roll your own dynamic compression. It will save you pain in the long run and give you more control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With