Answered by:
URL Rewrite Outbound Rules w/ Compression

Question
-
User-1348344323 posted
I have tried the new URL outbound rules with the UrlRewriter 2.0 and it is exactly what I want......except.....it does not work with compression. We use compression on our public website and would like to continue to use it and also use the new outbound rules with 2.0 version of the UrlRewriter. Is this an intial limitation to the outbound rules and will be available later or is this a strict limitation?
Thanks,
Mike
Monday, March 15, 2010 3:16 PM
Answers
-
User-1348344323 posted
I moved the DynamicCompression module down the list in the server module list. It appears before the RewriteModule in ordering. Dynamic and Static Compression is still enabled on the Web Server but not enabled on the web site compression settings. This appears to function fine, but when I enable Dynamic compression on the web site, CSS layout is not functioning correctly for various pages. If I disable Dynamic Compression on the web site, the CSS layout functions fine.
It seems like all compression must be off on the web site for URL outbound rewrites to function correctly. The Web server compression settings do not appear to have an effect.
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Wednesday, March 17, 2010 9:19 AM
All replies
-
User-1637866776 posted
Outbound rewriting can only be applied on un-compressed responses. If the response is already compressed then URL Rewrite Module will report an error if any of the outbound rules is evaluated against that response.
Oubound rewriting cannot be used together with IIS static compression.
Outbound rewriting can be used together with IIS dynamic compression by using the following workaround:
- Set the LogRewrittenUrlEnabled registry key:
<SAMP>reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0</SAMP> - Make sure that dynamicCompressionBeforeCache property is set to false for the /system.webServer/urlCompression configuration element.
- Re-order the IIS modules to have URL Rewrite module (RewriteModule) run before Dynamic Compression module (DynamicCompressionModule). In the IIS Manager user interface in the modules's ordered view the Dynamic Compression module should be above the URL Rewrite module.
Monday, March 15, 2010 5:23 PM - Set the LogRewrittenUrlEnabled registry key:
-
User-1348344323 posted
Thanks for the quick response. I added the registry key as specified, set the urlCompression attribute and reordered the modules. The Dynamic Compression setting still could not be set to true or the following error was thrown:
HTTP Error 500.52 - URL Rewrite Module Error.
Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip").
Here is the urlCompression configuration element:
<urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
Does the Dynamic Compression Module need to move down the list of order modules or does the RewriteModule need to move up the list before the DCompression module?
Also, where does the module reordering take place?....at the Web server level or at the web site level in the IIS Manager?
Thanks,
Mike
Tuesday, March 16, 2010 1:56 PM -
User-1637866776 posted
The Dynamic Compression Module should be above the Rewrite Module on the server level. After you've defined the registry key make sure to do "iisreset".
Tuesday, March 16, 2010 3:36 PM -
User-1348344323 posted
I moved the DynamicCompression module down the list in the server module list. It appears before the RewriteModule in ordering. Dynamic and Static Compression is still enabled on the Web Server but not enabled on the web site compression settings. This appears to function fine, but when I enable Dynamic compression on the web site, CSS layout is not functioning correctly for various pages. If I disable Dynamic Compression on the web site, the CSS layout functions fine.
It seems like all compression must be off on the web site for URL outbound rewrites to function correctly. The Web server compression settings do not appear to have an effect.
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Wednesday, March 17, 2010 9:19 AM -
User977097463 posted
Would you be so kind as to attach a screen shot, or full list, of the atypical modules in the Ordered List view? Thank you.
Saturday, May 15, 2010 12:40 PM -
User1654003307 posted
I'm running into this error however, I have static and dynamic compression disable on the URL Rewrite server and the backend (proxied) IIS server. I'm trying to proxy a SharePoint 2007 server. When I hit the SharePoint server directly and use a tool like Live Headers, none of the responses from the server have a Content-Type of gzip or deflate. I've gone through every response header... any idea why I'm still seeing this error?
Tuesday, June 29, 2010 4:44 PM -
User973888104 posted
@jedobray
I am assuming you are usng ARR as the proxy here and URL rewrite in the oubound rewriting. When you test with Live Headers was this done directly from your browser to the Sharepoint server or to the ARR server ?
If either, one thing we are not seeing here are the proxy request headers from the ARR server or the Response headers from sharepoint when the request is proxied. I am noting this becuse the Sharepoint server response ( compressed or not ) is dependent on the client asking for it the Accept-Encoding header and that may be different in direct vs proxied.
If you the Sharepoint Server is running on IIS 7.0 you could gather Failed Request tracing to see the Inbound/Outbound headers of the proxied request http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis-7/
If an IIS 6.0 you could traced this Network monitor.
If I am missing something in your configuration please let us know.
thanks
Richard
Thursday, July 1, 2010 11:35 AM -
User1654003307 posted
Richard,
Thanks for the reply. You are correct that I'm using IIS7/ARR/URL Rewrite for the proxy between the client and SharePoint servers. When I test with Live Headers, I'm bypassing the proxy and sending traffic directly to the SharePoint servers to determine if they are sending compressed responses to the client, which they do not appear to be. Here is an example request/reply from Live Headers (I've removed the domain name):
http://******************.org/Pages/home.aspx
GET /Pages/home.aspx HTTP/1.1
Host: *******************.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4 ( .NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: s_vi=[CS]v1|25A1E52785012F88-6000010B20000F4D[CE]; foresee.repeatdays=90; ISAWPLB{E0DC1DE6-CEDB-42B8-AB16-790992D616A4}={2EB765FE-6CB4-48BF-8D6B-858EAC9432DC}HTTP/1.1 200 OK
Connection: Keep-Alive
Expires: Mon, 14 Jun 2010 20:30:39 GMT
Date: Tue, 29 Jun 2010 20:30:39 GMT
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6529
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Last-Modified: Tue, 29 Jun 2010 20:30:39 GMT
Transfer-Encoding: chunkedYou can see that the client will accept gizp/deflate compression but the SharePoint server is sending a response typ in text/html. I've reviewed all headers from a page load and none of the responses appear to be coming back to the client compressed.
Thanks,
Jed
Thursday, July 1, 2010 11:44 AM -
User1654003307 posted
Re-enabling and re-disabling dynamic/static compression on the SharePoint IIS site has resolve this issue. Thanks for your assistance Richard.
Thursday, July 1, 2010 12:34 PM -
User-1730009568 posted
Shouldn't the URL Rewrite module appear above the Dynamic Compression module? In the ordered list view, modules appearing earlier in the list get executed before the later modules. Since we want the URL Rewrite to occur before compression, the URL Rewrite module should appear earlier.
-bob
Friday, July 16, 2010 2:47 PM -
User973888104 posted
@ rchivert
The modules are processed in reverse order on the outbound request . So we want UrlRewrite below compression so it can processed before the request is compressed.
hth
richard
Friday, July 16, 2010 3:11 PM -
User-1730009568 posted
"Oubound rewriting cannot be used together with IIS static compression."
Does this mean we need to explicitly disable static compression?
-bob
Friday, July 16, 2010 3:37 PM -
User-144426733 posted
I know this post is old but...
I have followed the directions mentioned and have added the registry key, and set the dynamicCompressionBeforeCache property to false however whenever I enable an outbound URL rewrite with dynamic compression I get the error "outbound rewrite rules cannot be applied when the content of the http response is encoded ("gzip")"
The following is my web.config file, any help would be greatly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
</httpErrors>
<directoryBrowse enabled="false" />
<rewrite>
<outboundRules>
<rule name="testing" enabled="false">
<match filterByTags="A, Area, Base, Form, Img" pattern="^images/logo_and_image.jpg$" />
<action type="Rewrite" value="http://mycdndomain.com/productcart/pc/images/email_signature/logo_and_image.jpg" />
<conditions trackAllCaptures="false" />
</rule>
<customTags>
</customTags>
</outboundRules>
</rewrite>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<remove name="X-Powered-By-Plesk" />
</customHeaders>
</httpProtocol>
<urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
</system.webServer>
</configuration>
Thursday, June 7, 2012 8:33 PM -
User-745602158 posted
http://webgeek.elletis.com/difference-between-url-mapping-and-url-rewriting/Sunday, June 10, 2012 9:45 AM -
User-144426733 posted
http://webgeek.elletis.com/difference-between-url-mapping-and-url-rewriting/This does not help. I am re-writing the urls as we are loading files from a CDN & don't want to just simply map the current requests to a cdn.
Wednesday, June 13, 2012 8:36 PM -
User-1030562098 posted
I know this is an old one, but hey I just seen the plugin and have been setting up url rewrite on my site.
After getting changing the file paths for the pages I wanted rewritten, and then getting over compression issues and disabling them entirely I seen this post.
so I have added the 3 points as highlighted here and when I go enable dynamic compression I get a server 500 error when trying to view any of the site pages.
Once I disable it again it works fine, but of course I could really do with dynamic compression enabled.......
Any suggestions?
Thanks in advance
Wednesday, March 6, 2013 10:29 AM -
User973888104 posted
I am assuming you are referring to the followings stepos, reposting in case.
The one I would double check is the module order
For outbound you want Dynamic Compression Above . URLRewrites as they are processed in revese order on the way out.
Outbound rewriting can be used together with IIS dynamic compression by using the following workaround:
- Set the LogRewrittenUrlEnabled registry key:<samp>reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0</samp>
- Make sure that dynamicCompressionBeforeCache property is set to false for the /system.webServer/urlCompression configuration element.
- Re-order the IIS modules to have URL Rewrite module (RewriteModule) run before Dynamic Compression module (DynamicCompressionModule). In the IIS Manager user interface in the modules's ordered view the Dynamic Compression module should be above the URL Rewrite module.
To trobuleshoot use Failed Request Tracing and it will tell you if the Compression Module is being invoked before UrlRewrite.
Wednesday, March 6, 2013 4:52 PM