IIS 7 rewriting subdomain to point at a specific port

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 access tfs.server.domain.com/repos_name it should redirect to http://localhost:8080/tfs/repos_name.

How can I do this in IIS7?

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>

EDIT

I actually got this working by adding a binding for the site on port 80 with host name tfs.server.domain.com.

But using tfs.server.domain.com, I can't authenticate using Windows Authentication. Is there something that I need to configure for Windows Authentication?

You can see a trace here: http://pastebin.com/k0QrnL0m


Solution 1:

Does it work still when using the http://localhost:8080/tfs link? The authentication is probably unrelated to the URL pattern.

Are you only testing from localhost? If so you may be running into the loopback check issue: http://support.microsoft.com/kb/896861. Try testing from another machine and it may work for you, or you can make either of the changes in that KB article.