Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bobi 352 posts 956 karma points
    Mar 30, 2017 @ 04:32
    Bobi
    0

    IIS URL Rewrite Causes Slow Performance

    Hi,

    I am using IIS URL Rewrite 2.0 for some rules in my web.config, since UrlRewriting.config is out-dated, and it is suggested to use IIS URL Rewrite instead. However, immediately after adding two simple rules to my web.config, my website is performing slowly...I am running Sql Server Express, so it's not a database issue.

    The slow performance occurred immediately after reloading a web page (any page, not just the specific url sitemap.xml seen below) upon saving the rules in the web.config.

    Any help / suggestions?

    Here are my rewrite rules in <system.webServer>

    <!-- IIS Rules Rewrite -->
       <rewrite>
       <rules>
        <!-- Serve site map with proper XML content type response header. -->
        <rule name="Sitemap XML" enabled="true" stopProcessing="true">
          <match url="sitemap.xml" />
          <action type="Rewrite" url="sitemap.aspx" appendQueryString="false"/>
        </rule>
        <!-- Access block rule - is used to block all requests made to a Web site if those requests do not have the host header set. This type of rule is useful when you want to prevent hacking attempts that are made by issuing HTTP requests against the IP address of the server instead of using the host name -->
        <rule name="Fail bad requests">
          <match url=".*"/>
          <conditions>
            <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
          </conditions>
          <action type="AbortRequest" />
        </rule>
        <!-- HTTP to HTTPS Rule 
        <rule name="Redirect to https" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" negate="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTPS}" pattern="off" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
        </rule>-->
      </rules>
    </rewrite>
    
  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Mar 30, 2017 @ 05:17
    Nicholas Westby
    0

    Those redirects seem very unlikely to cause any issues. What happens if you get rid of them (or just some of them)? Do you have errors in your Umbraco log? Is your CPU usage high?

  • Bobi 352 posts 956 karma points
    Mar 30, 2017 @ 05:34
    Bobi
    0

    If I get rid of them, website performance appears back to normal.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Mar 30, 2017 @ 05:35
    Nicholas Westby
    0

    What if you use a process of elimination to see if there is a particular one that is causing issues?

  • Bobi 352 posts 956 karma points
    Mar 30, 2017 @ 05:44
    Bobi
    0

    It seems like the first one (re sitemap.xml) is causing the slowdown...it just doesn't make sense...

    I have them under the first

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 30, 2017 @ 08:18
    Dan Diplo
    1

    It doesn't make sense to me. I've got websites that have literally hundreds of similar redirects in IIS and it the performance impact is too negligible to even notice. And it is definitely a fact that IIS rewrites are more efficient than ones in the old UrlRewriting.net config.

    NB. There's no reason why a sitemap file that returns XML needs to have a .xml extension - it just needs to return content-type of text/xml - so you could just reference sitemap.aspx in your robots.txt and it should be fine.

  • Bobi 352 posts 956 karma points
    Mar 30, 2017 @ 16:01
    Bobi
    0

    I don't understand it either. I put it under system.webServer...so it's not in the wrong place.

  • Mark Bowser 273 posts 860 karma points c-trib
    Mar 30, 2017 @ 23:44
    Mark Bowser
    101

    This seems really strange to me as well. What if you try to escape the period in the match tag like this:

    <match url="sitemap\.xml" />
    

    This really shouldn't help, but since we are at a loss, we may as well try the crazy. If this doesn't help, I can only assume that there is some sort of problem with Url Rewrite on your server. Does this happen on any other servers? What if you update the Url Rewrite Module in IIS?

  • Bobi 352 posts 956 karma points
    Mar 31, 2017 @ 19:27
    Bobi
    0

    @Marc, that seemed to work...what the...?!

  • rob 75 posts 170 karma points
    Oct 31, 2017 @ 11:43
    rob
    0

    the match url value is a regular expression, so full stops(amongst other things) must be escaped.

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference

Please Sign in or register to post replies

Write your reply to:

Draft