I am building an app where I have XX number of customers who can run on a single instance. The application scales out by adding more nodes (thus supporting XX more customers). I want a way to use a single IP address so I can have customers setup CNAME's to use their own custom URLs.

I also want the ability to migrate customers to different nodes, which would mean that the CNAME would need to point to a different IP address.

My thought would be I could point everyone to a single IP address, then have that application route customer requests to the different server nodes. This is just like what a load balancer would do (from my research), but for all I want to do, that seems a bit of overkill.

I would prefer a way to do this in .NET, but am open to any technology to accomplish the goal.

migrated from stackoverflow.com Nov 30 '11 at 19:40

This question came from our site for professional and enthusiast programmers.


You didn't mention using HTTP anywhere, but you tagged the questions as "web-applications" and "web-farm", so I'm assuming this is what your application uses; if this is your case, then this looks like the exact type of job a reverse proxy exists for.

You set up N internal servers, each one running on its own internal IP address, and you configure IIS (or whatever web server you're using) on each server to handle the web site names that server will be answering to.

Then you give your reverse proxy an internal IP address which can talk to the internal server and an external, public IP address.

You then make all public DNS names point to the reverse proxy's external address.

Finally, you configure your reverse proxy so that requests for a given web site name are forwarded to the internal web server that's actually hosting it.

Et voilà.

I know for sure both ISA Server 2006 and ForeFront TMG 2010 can do this easily, but of course you can use any reverse proxy software you want.

Of course, you can use an array of load-balanced reverse proxies for high availability and load balancing.


You could do this in .NET but I think your still going to have some kind of DNS type service in play.

My suggestion would be to have an internal DNS that resolves the IP's of your internal farm machines.

Set your Bindings up in IIS7 to respond to all customer created url's, and have a public DNS server alias each one to the single IP at your front end.

Once your front end server is hit, retrieve the host name used from the HTTP variables, then use your internal DNS to find which IP the actual service is on.

Once you know the IP, then it's simply just a case of forwarding all comms to that IP.

  • How do I do the actual forward? I can store the IP's of customers to nodes in a table and look all that up no problem, or use internal DNS as you suggested, but what I am struggling with is how to make the user who hits the front end server forward a node server based upon configuration. – Steve Sloka Nov 30 '11 at 19:43
  • Good question, tbh I've never put that into play, but off the top of my head..... Beacuse this is a web app, you could send back a http redirect, which if the servers are publicly accessible could be simply an ip EG: redirect to If there not public, you could set up some kind of tunnel on the public IP on a random port, connect one end to your internal server, and listen on your public IP, then send back a redirect back to your own public server but on the random port. EG:, use the .NET process object to run a utility like stunnel or netcat to create the proxy. – shawty Nov 30 '11 at 19:57

This looks like a job for an IIS Server Farm. Note that from the .NET side you'll have to author the application to handle state and other features correctly. Your clients will have weird issues if/when the load balancing or failover kicks in.

You definitely want Windows Server/IIS to handle the clustering for you, mainly because Microsoft already did the heavy lifting in getting the application-level clustering to work.


I would use a HAProxy loadbalancer to accomplish this task. It's a linux solution, but it can easily load balance HTTP or TCP requests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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