简体   繁体   中英

URL Rewrite Outbound Rules IIS7

Experimenting with URL rewrites using this module, however I'm getting the following error when attempting to hit the URL. Looked online for answers, but not sure what the best way to get around this is.... any ideas??

HTTP Error 500.52 - URL Rewrite Module Error. Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip").**

IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.

IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.

IIS was not able to process configuration for the Web site or application.

The authenticated user does not have permission to use this DLL.

The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

I've tried the comments by aracntido, but it doesn't seem to work in IIS7. It works fine on servers with IIS7.5, so I'm not sure whether there is a work around.

The fix is to use this in the web.config:

<system.webServer>
  <urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
</system.webServer>

This is by design, it means that the HTML was already zipped when it became available for the URL Rewrite module, so it couldn't rewrite it because it would have to unzip it first, rewrite it and then zip it again and that is too much processor power. If it is dynamic content, try to rewrite it before compress it.

Move Dynamic Compression module after URL Rewrite module in "Modules" at server level (InetMgr). Disable "log rewritten URL" for the rule (default), otherwise the module will try to be the last one in the pipeline.

Static compression is not compatible with outbound rewriting.

Although disabling static and dynamic compression works nicely this method are not working with *.axd files. This files are client side resources, like js, Ajax and so on. Read more on axd files HERE .

Because this files are compressed automatically. Read HERE more about why!

So easier way to make them work is sending request with setting Accept-Encoding header to empty! This is possible in two ways:

  1. [BAD] changing your firefox setting HOW?
  2. [NICE] setting an inbound rule to clear Accept-Encoding in header! HOW?

Switching off static compression (unnecessary for my situation) in IIS 7.0 fixed a similar problem where URLs would load but a page refresh would produce a basic error 500.

I added index.html to the URL and this refined the error to 'HTTP Error 500.52 - URL Rewrite Module Error. Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip")' error.

Thanks to aracntido for pointing this out, you helped me nail the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM