5

Hello.

I am using HttpContext.RewritePath to direct request to inner site folders depending from request and host.

Problem: When I do any request that requires RewritePath for any static file that is cached and GZIPped by IIS, I get in response original non-compressed file content with Content-Encoding: gzip header, which leads to “Content decoding has failed” error. But when I do same request but with full directory path (in that case RewritePath is skipped in my code) I get right gzipped content with Content-Encoding: gzip.


E.g.:
Situation with error:
Request url: localhost/lib/ext_3.4.0/resources/css/ext-all.css
Request path is rewrited using HttpContext.RewritePath to: localhost/_sites/mainSite/lib/ext_3.4.0/resources/css/ext-all.css

First response is not gzipped - usual IIS behavior. When I press ctrl+F5, I get “Content decoding has failed” error. By using Fiddler2 I can see that response content is not gzipped and it contains Content-Encoding: gzip header.

Situation without error:
Request url: localhost/_sites/mainSite/lib/ext_3.4.0/resources/css/ext-all.css
Request path is not rewrited because it is not needed.

First response is not gzipped again. When I press ctrl+F5, I get normal file content. By using Fiddler2 I can see that response content is gzipped, size is 5 times less and it contains Content-Encoding: gzip header.


I can't throw away RewritePath and I need IIS gzip. Is there any way to make them friends?

Omnik
  • 161
  • 9
  • Did you find a solution to this problem? We have the same problem as you, i.e. rewriting the path of a static file, and that makes IIS to send the file uncompressed while it should have been compressed. – sboisse Oct 25 '12 at 18:05

0 Answers0