URL Rewrite Outbound Rules w/ Compression [Answered]RSS

17 replies

Last post Mar 06, 2013 04:52 PM by richma

  • URL Rewrite Outbound Rules w/ Compression

    Mar 15, 2010 03:16 PM|mwmorris165|LINK

    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

    mwmorris165
  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 15, 2010 05:23 PM|ruslany|LINK

    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:

    1. Set the LogRewrittenUrlEnabled registry key:
      reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0
    2. Make sure that dynamicCompressionBeforeCache property is set to false for the /system.webServer/urlCompression configuration element.
    3. 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.
  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 16, 2010 01:56 PM|mwmorris165|LINK

    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

     

     

    mwmorris165
  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 16, 2010 03:36 PM|ruslany|LINK

    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".

  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 17, 2010 09:19 AM|mwmorris165|LINK

    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.

    mwmorris165
  • Re: URL Rewrite Outbound Rules w/ Compression

    May 15, 2010 12:40 PM|SpryNM|LINK

     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.

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jun 29, 2010 04:44 PM|jedobray|LINK

    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?

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 01, 2010 11:35 AM|richma|LINK

    @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 

     

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 01, 2010 11:44 AM|jedobray|LINK

    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: chunked

    You 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

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 01, 2010 12:34 PM|jedobray|LINK

    Re-enabling and re-disabling dynamic/static compression on the SharePoint IIS site has resolve this issue.  Thanks for your assistance Richard.

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 16, 2010 02:47 PM|rchivert|LINK

    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

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 16, 2010 03:11 PM|richma|LINK

     

    @ 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

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jul 16, 2010 03:37 PM|rchivert|LINK

    "Oubound rewriting cannot be used together with IIS static compression."

    Does this mean we need to explicitly disable static compression? 

     -bob

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jun 07, 2012 08:33 PM|namamai|LINK

    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>
     

  • Re: URL Rewrite Outbound Rules w/ Compression

    Jun 10, 2012 09:45 AM|coolansh63|LINK

    http://webgeek.elletis.com/difference-between-url-mapping-and-url-rewriting/
  • Re: URL Rewrite Outbound Rules w/ Compression

    Jun 13, 2012 08:36 PM|namamai|LINK

    coolansh63

    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.

     

     

  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 06, 2013 10:29 AM|JamieO|LINK

    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

  • Re: URL Rewrite Outbound Rules w/ Compression

    Mar 06, 2013 04:52 PM|richma|LINK

    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:

    1. Set the LogRewrittenUrlEnabled registry key:reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0
    2. Make sure that dynamicCompressionBeforeCache property is set to false for the /system.webServer/urlCompression configuration element.
    3. 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.