Hi IIS.net community!
I've got a problem using the URL Rewrite Module through an ISA 2006 Web Publishing Rule.
First I set up a rule in IIS to enforce a hostname for a site with multiple hostheaders (www.example.net, example.net). Regardless of the URL the user enters he shall be redirected to example.net/...
<rewrite>
<rules>
<rule name="Enforce Hostname" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^example\.net$" />
</conditions>
<action type="Redirect" url="http://example.net/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
This rule works without problems if the client can access the webserver directly. However, if the site is published through ISA server I'm not able to get it working. The relevant information of the rule is as follows:
[To]
This rule applies to this published site: example.net
Computername ...: webserver.domain.local
Forward the original host header: YES
Requests appear to come from the original client
[Public Name]
example.net
www.example.net
If an external client tries to browse the website via http://example.net/site.html everything works fine. However, if the user types http://www.example.net/site.html he gets stuck in a loop redirecting exactly to the site he came from.
A Netmon trace on the client confirms this behaviour. It receives an HTTP response with a response header
StatusCode: 301
Location: http://www.example.net/site.html
Furthermore the payload of the response contains a link to http://www.example.net/site.html.
The contents of the payload are correct if link translation in the ISA publishing rule is deactivated. The relevant part in the response header is not affected by this option.
Can anybody help me with this problem? Did someone manage to get redirect rules with URL rewrite module working through ISA Server?
Many thanks,
MRVirtual.