Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Compression Module and Vary: Accept-Encoding Header

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...

like image 970
jjxtra Avatar asked Mar 20 '11 22:03

jjxtra


People also ask

What is vary accept-Encoding header?

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.

How do I add a accept-Encoding 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.

What does accept-encoding gzip deflate mean?

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.

What is content encoding GZIP?

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.


2 Answers

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

like image 83
Erez Benari Avatar answered Oct 19 '22 00:10

Erez Benari


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.

like image 23
jjxtra Avatar answered Oct 19 '22 01:10

jjxtra