IIS 7 rewriting subdomain to point at a specific port.
- by Tommy Jakobsen
Having installed Team Foundation Server 2010 on Windows Server 2008, I need an easy URL for our developers to access their repositories.
The default URL for the TFS repositories is http://localhost:8080/tfs
Now I want the subdomain domain tfs.server.domain.com to point at http://localhost:8080/tfs. And when you write access tfs.server.domain.com/repos_name it should redirect to http://localhost:8080/tfs/repos_name.
How can I do this in IIS 7?
I already tried using the following rule, but it does not work. I get a 404.
<rewrite>
    <globalRules>
        <rule name="TFS" stopProcessing="true">
            <match url="^(?:tfs/)(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^tfs.server.domain.com$" />
            </conditions>
            <action type="Rewrite" url="http://localhost:8080/tfs/{R:1}" />
        </rule>
    </globalRules>
</rewrite>