Friday, May 18, 2012

Serving Unlimited Domains From IIS, pt 1

In an upcoming version of a currently-in-development webapp, I need to serve multiple domains from a single site. The code on the site will recognize the individual domains and vary the content accordingly. I do not know all of the domains that we will be serving, as clients can add new domains to their site. The coding parts, I know how to do - when clients add a domain, there will be a corresponding entry into our database and that will act as a key to control which set of content is shown.

The thing is, I suck at system administration. If I knew the domains ahead of time, I could simply point them to our server's IP and then create bindings in IIS to handle each. But since I do not know the domains ahead of time, I'm rather at a loss. I welcome any suggestions. Expect part 2 of this entry in the coming weeks, to reflect whatever solution I find.

2 comments:

  1. I would imagine the only way to do this is to dip into the right DLL to add the domain dynamically both to IIS and to your DNS server (if they are on the same box). I imagine the easiest way would be to write a C++ service to provide an interface to muck with those internals, and have callouts to it from your ASP / whatever code.

    This would be extremely scriptable with Apache and BIND / tinydns. :) Just saying.

    ReplyDelete
  2. The DNS part is something that I will be leaving up to the clients/customers of the site. They will be the ones who own the domains and control where they are pointed. As to the IIS bindings, I have a few different answers now, which I'll be posting in part 2 in a few minutes.

    ReplyDelete