I have two IIS7 web servers behind a load-balancer. The URL Rewrite 2.0 module is installed on both servers and the following rewrite rule applied to both instances:
<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^www\.mydomain\.com$" />
</conditions>
<action type="Redirect" url="http://www.mydomain.com/{R:1}" redirectType="Permanent" />
</rule>
When I try to navigate to http://mydomain.com, my web browser hangs 开发者_开发知识库indefinitely. I suspect the load-balancer is affecting the way URL Rewrite works, but I can't be certain.
We ended up using the following technique:
http://www.mcanerin.com/en/articles/301-redirect-iis.asp
The key was to add the $S$Q to the end of the domain name.
My guess is , 1. load balancer forwards your request to your child servers 2. and when request comes to child servers they redirect the request according to your URL redirect rule, so your request is redirected and again comes on Load balancer 3. and the same procedure(step 1-2) is followed,
thus your request loops again and again and your browser gets hanged.
精彩评论