KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to add a Vary: Accept-Encoding header to the response to files that I compress, as advised earlier . However, for some reason this is not possible - either from the Visual Studio test server, or an IIS server. I have the following code: if (url.Contains(".js") || url.Contains(".aspx") || url.Contains(".css")) { app.Response.AppendHeader("Vary", "Accept-Encoding"); app.Response.AppendHeader("Varye", "Accept-Encoding"); // for testing app.Response.AppendHeader("Varye", "Accept-Things"); // for testing app.Response.AppendHeader("Vary", "Accept-Stuff"); // for testing app.Response.AppendHeader("Var", "Accept-Items"); // for testing encodings = encodings.ToLower(); if (encodings.Contains("gzip") || encodings == "*") { app.Response.Filter = new GZipStream(baseStream, CompressionMode.Compress); app.Response.AppendHeader("Content-Encoding", "gzip"); } } this results in the following response header: Status=OK - 200 Server=ASP.NET Development Server/10.0.0.0 Date=Fri, 21 Oct 2011 12:24:11 GMT X-AspNet-Version=4.0.30319 Varye=Accept-Encoding, Accept-Things Var=Accept-Items Content-Encoding=gzip Cache-Control=public Etag="1CC8F2E9D772300" Content-Type=text/css Content-Length=16200 Connection=Close As you can see, the Vary header is not present. Meaningless headers with similar syntax are present, so there must be something, somewhere, taking out the Vary header before it is sent. I don't know if it is relevant, but here is where I define my compression module in web.config: <httpModules> <add name="CompressionModule" type="Utility.HttpCompressionModule"/> </httpModules> (Where Utility.HttpCompressionModule is the class which the code exc
Tags (comma-separated)
Save Edits
Cancel