HttpContext.RewritePath clogs buildin IIS gzip

Hello.

I use HttpContext.RewritePathto directly query the internal folders of the site depending on the request and the host.

Problem: When I execute any request that requires RewritePath for any static file that is cached and GZIPped IIS, I get the original contents in response without a compressed file with a header Content-Encoding: gzip, which leads to a "Content Decoding Error" error. But when I make the same request, but with the full directory (in this case RewritePath is skipped in my code), I get the right gzipped content with Content-Encoding: gzip.


etc .:
Error situation:
Request URL: localhost/lib/ext_3.4.0/resources/css/ext-all.css
Request path rewritten using HttpContext.RewritePath for:localhost/_sites/mainSite/lib/ext_3.4.0/resources/css/ext-all.css

The first answer is not gzip - the usual IIS behavior. When I press ctrl + F5, I get the message "Content Decoding Error". Using Fiddler2, I see that the response content is not gzipped and contains a header Content-Encoding: gzip.

Error-free situation:
Request URL: localhost/_sites/mainSite/lib/ext_3.4.0/resources/css/ext-all.css
The request path was not rewritten because it is not needed.

The first answer again is no gzipped. When I press ctrl + F5, I get the normal contents of the file. Using Fiddler2, I see that the response content is gzipped, 5 times smaller and contains a header Content-Encoding: gzip.


I cannot throw away RewritePath, and I need IIS gzip. Is there any way to make them friends?

+5
source share

All Articles