Copied to clipboard

Flag this post as spam?

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

  • Bobi 280 posts 743 karma points
    Mar 30, 2017 @ 04:32

    IIS URL Rewrite Causes Slow Performance


    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 -->
        <!-- 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"/>
        <!-- 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=".*"/>
            <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
          <action type="AbortRequest" />
        <!-- 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" />
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
  • Nicholas Westby 2024 posts 6950 karma points c-trib
    Mar 30, 2017 @ 05:17
    Nicholas Westby

    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 280 posts 743 karma points
    Mar 30, 2017 @ 05:34

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

  • Nicholas Westby 2024 posts 6950 karma points c-trib
    Mar 30, 2017 @ 05:35
    Nicholas Westby

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

  • Bobi 280 posts 743 karma points
    Mar 30, 2017 @ 05:44

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

    I have them under the first

  • Dan Diplo 1540 posts 6094 karma points MVP 4x c-trib
    Mar 30, 2017 @ 08:18
    Dan Diplo

    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 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 280 posts 743 karma points
    Mar 30, 2017 @ 16:01

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

  • Mark Bowser 266 posts 852 karma points c-trib
    Mar 30, 2017 @ 23:44
    Mark Bowser

    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 280 posts 743 karma points
    Mar 31, 2017 @ 19:27

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

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

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

Please Sign in or register to post replies

Write your reply to: