title: Firebug page speed warning: enable compression
body: <p>I am doing some nitpicky seo and I am worried about firebug showing that my bundled and minifed css files are not compressed, I am using action filter to append gzip header, but I don't know why it is not working for minified/bundled css and js files? </p>
  
  <p>Here is filter:</p>
  
  <pre><code>  public class CompressFilter : ActionFilterAttribute
      {
          public override void OnActionExecuting(ActionExecutingContext filterContext)
          {
              HttpRequestBase request = filterContext.HttpContext.Request;
  
              string acceptEncoding = request.Headers["Accept-Encoding"];
  
              if (string.IsNullOrEmpty(acceptEncoding)) return;
  
              acceptEncoding = acceptEncoding.ToUpperInvariant();
  
              HttpResponseBase response = filterContext.HttpContext.Response;
  
              if (acceptEncoding.Contains("GZIP"))
              {
                  response.AppendHeader("Content-encoding", "gzip");
                  response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
              }
              else if (acceptEncoding.Contains("DEFLATE"))
              {
                  response.AppendHeader("Content-encoding", "deflate");
                  response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
              }
  
              response.AppendHeader("Connection", "keep-alive");
          }
      }
  </code></pre>
  
  <p>I register it in Application_Start() so i don't have to do it on each controller:</p>
  
  <pre><code>GlobalFilters.Filters.Add(new CompressFilter());
  
  RegisterGlobalFilters(GlobalFilters.Filters);
  </code></pre>
  
  <p>And I even have this in config:</p>
  
  <pre><code>&lt;urlCompression doStaticCompression="true" doDynamicCompression="true" /&gt;
  </code></pre>
  
  <p>Headers are correct for views but nothing for css and js.. How can I fix that?</p>