What might be causing my site's pages to load more slowly in these IIS Rewrite Module rules?

What might be causing my site's pages to load more slowly in these IIS Rewrite Module rules? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the What might be causing my site's pages to load more slowly in these IIS Rewrite Module rules? error on your web browser. Problem :


I have the following IIS rewrite rules that work exactly as I wish on both my development and live servers within an Orchard CMS website, though when enabled, seriously slow the site's page loads. This is easily tested by enabling/disabling the rules to notice the performance decrease, which appears to accrue (i.e. not one rule more than others).



As these are the first rules I've ever created, I imagine there may be some obvious pitfalls, though my research hasn't lead me to discover any.



So simply put, what might be causing the slowdown in my page load times (...perhaps order?):



    <rewrite>
<rules>
<rule name="www to non-www" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="HTTP_HOST" pattern="^www.(.*)$" />
</conditions>
<action type="Redirect" url="http://C:1/R:0" redirectType="Permanent" />
</rule>

<rule name="Dont Process Any Further" enabled="true" stopProcessing="true">
<match url="^(about-us$|contact$|copyright$|privacy$|terms$|book$|surroundings$|
Admin|Media|Themes|Modules|Core|Users|Orchard|source
)" />
<!-- Match url, Line (1): user specific. Line (2): app specific -->
<action type="None" />
</rule>

<!--When root/url requested, goto _domain_index-->
<rule name="Rewrite - Root Hit Redirect" enabled="true">
<match url="^$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="HTTP_HOST" pattern="^(www.)?brun.azurewebsites.net" negate="true" />
<add input="HTTP_HOST" pattern="^(www.)?brun.com" negate="true" />
<add input="HTTP_HOST" pattern="^(www.)?(.*).com" />
</conditions>
<action type="Rewrite" url="_C:2_index" />
</rule>

<!--Note: the first pattern in this rule stops the *possible* above rules URL
being rewritten again i.e _domain_index to _domain__domain_index, whilst
also allowing 'View' links from Orchards Dashboard to work-->
<rule name="Rewrite - /page to /_domain_page" enabled="true">
<match url="^(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<!--<add input="REQUEST_URI" pattern="/_([a-zA-Z]+)_index$" negate="true" />-->
<add input="REQUEST_URI" pattern="/_([a-zA-Z]+)_([a-zA-Z]+)$" negate="true" />
<add input="REQUEST_FILENAME" matchType="IsFile" negate="true" />
<add input="REQUEST_FILENAME" matchType="IsDirectory" negate="true" />
<add input="HTTP_HOST" pattern="^(www.)?brun.azurewebsites.net" negate="true" />
<add input="HTTP_HOST" pattern="^(www.)?brun.com" negate="true" />
<add input="HTTP_HOST" pattern="^(www.)?(.*).com" />
</conditions>
<action type="Rewrite" url="_C:5_R:1" />
</rule>
</rules>
</rewrite>

Solution :

From past experience I think you may find that the issue will be memory related and not precisely related to the rewrite rules per-say. What I have found in the past, although I can't find it documented anywhere is that IIS heavily depends on the system memory to perform URL rewriting, I believe it has something to do with caching the rules. If this is the problem it may be a simple case of provisioning additional memory to the server for IIS to use.



There is also a known memory leakage to do with IIS rewrite rules which I recall but can't place my hands on the documentation at this time for, although there was an update made available for it. If this is the case it should be able to be fixed by updating IIS to the latest version along with all updates, service packs, and hotfixes, one of which I do recall added functionality to clean up the internal cache.


We hope that this article has helped you resolve the redirects, url-rewriting, performance error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

What is the SEO impact of multiple redirects that return to the current page after setting a cookie?

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?