Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 246
denisb Avatar asked Sep 15 '10 00:09

denisb


People also ask

How do I enable URL Rewrite in IIS 8?

First, open your IIS Manager and click on Default Web Site at the left panel. Double-click on the URL Rewrite module, as shown below, to add rewrite rules. 2. Next, click on Add Rule(s) option at the right panel, and a pop-up window appears where you'll select a rule template.

What is URL Rewrite rules?

A rewrite rule defines the logic of what to compare or match the request URL with, and what to do if the comparison is successful. Rewrite rules consists of the following parts: Pattern – The rule pattern is used to specify either the regular expression or a wildcard pattern that is used to match URL strings.


2 Answers

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>
like image 78
SeaSharp Avatar answered Oct 11 '22 19:10

SeaSharp


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.

like image 26
aracntido Avatar answered Oct 11 '22 19:10

aracntido