I'm trying to set up my IIS server as an origin server for a CDN. I have solved some issues already for example that IIS doesn't give gziped content to proxies (if they have the via header) and also that frequentHitThreshold problem.
My CDN supplier pointed out that another problem with IIS is that it doesn't return a "Vary" header if the client doesn't request the content gziped. According to them the problem is that if for some reason the first client that request the content doesn't want the content gziped the CDN then doesn't request a new version of the file since the Vary header doesn't indicate that it should return two different files depending on "Accept-Encoding".
My only solution so far is to add "Vary: Accept-Encoding" as a custom header but since IIS automatically add this vary header when gziped is requested so i end up with multiple values like "Vary: Accept-Encoding, Accept-Encoding".
Anyone have any solution to this? Or can confirm that it's a real issue.
But there's no: Content-Encoding: gzip In the Response Header. In my case problem was with antivirus protection. Actually gzipping was applied but antivirus with enabled settings protect http connections (depends on concrete program), unzip response check it and after that rewrite response headers on the fly.
It's important to include the Vary: Origin header to prevent caching. The header indicates that the response is in some way dependent on the origin and should therefore not be served from cache for any other origin.
This response header is used by the server to indicate the headers it used when selecting a representation of a resource in a content negotiation algorithm. The Vary header should be set on a 304 Not Modified response exactly like it would have been set on an equivalent 200 OK response. Vary: * Vary: <header-name>, <header-name>, ...
This response header is used by the server to indicate the headers it used when selecting a representation of a resource in a content negotiation algorithm. The Vary header should be set on a 304 Not Modified response exactly like it would have been set on an equivalent 200 OK response.
This is a real issue. IIS gzip module overwrites existing Vary headers. Please vote on this MS Connect issue. Related article here.
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
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