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>
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?
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.
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?
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>
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?
If I get rid of them, website performance appears back to normal.
What if you use a process of elimination to see if there is a particular one that is causing issues?
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
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.I don't understand it either. I put it under system.webServer...so it's not in the wrong place.
This seems really strange to me as well. What if you try to escape the period in the match tag like this:
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?
@Marc, that seemed to work...what the...?!
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
is working on a reply...