Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In effect I'm working on a SaaS application where I want to give subscribers their own subdomain to access their information (in code I will be pulling the first part of the subdomain for use as their account name), similar to how Basecamp et all work. For instance, a subscriber might have the URL acme.myapp.com. Since there could be hundreds of subscribers I can't simply add a different host header for each client.

Apache allows you to specify a wildcard (*) and will redirect acme.myapp.com to myapp.com, wherein I can perform my logic to retrieve the user's account name based on the subdomain. I'm not sure how to automatically do this with IIS (It's been a while since I've had to configure IIS for anything except a single website).

Also, is there any special provisions that I need to accomplish this? When my app is ready and I'm looking at hosting for it, will I need anything specific from the host that would limit my choices? I was also considering using Windows Azure to take advantage of the cloud - would I still be able to do this if I went with Azure as a hosting platform?

share|improve this question
    
Which version of IIS is this, 6 or 7 –  Sam Nov 15 '09 at 15:23
    
IIS7 (local box running Win7). Hosting will probably be on Server 2008 so I can assume IIS7 always. –  Wayne M Nov 15 '09 at 15:38

2 Answers 2

As Joe mentioned you would do this more with DNS than IIS.

IIS does not have support for *.domain.com wildcard domains. Instead you would create a site in IIS that had no host headers, so would respond to all requests on that IP that were not picked up by other sites that did have host headers. You would then create your wildcard DNS entry to point to the IP of that site and your done.

share|improve this answer
    
So there is no way to "fake" it without having the domain setup and doing it with DNS? I'm asking because I would like to test the account part (e.g. that acme.myapp.xxx retrieves the account for Acme), but if I'm understanding right it means I cannot test this with IIS unless I purchase the domain and set up the IP address? –  Wayne M Nov 15 '09 at 16:33
1  
Well if your just wanting to test it, you could setup IIS, then put some entrys in your local HOST file for the subdomains you want to test, so they point to you IIS server, this will allow you to test them on your machine without purchasing the domain. –  Sam Nov 15 '09 at 16:44
    
As long as you only have an application per port in your IIS. –  Marc Climent Dec 1 '10 at 17:44

If I'm understanding you correctly, you could use DNS to do this. Assuming that myapp.com is your domain, then in your myapp.com DNS zone simply add a CNAME record (acme) that points to the A record for your web site (www.myapp.com). That will send them to your main web site, where your code will take over and redirect them to the appropriate application.

You could also use a DNS wildcard record (*) which will catch everyting, such as acme.myapp.com, joeschmoe.myapp.com, etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.