0

What is the most scalable and simple way to have a node app serving many domains ?

I feel like many hosting services like nodejitsu don't support this (they actually told me this in an email)

My idea is to have the users redirect a domain to me (like tumblr) and then on the nodejs app I get the domain I'm serving like this:

req.headers.host

and then I simply serve the "template" with the user's options in the DB..

coiso
  • 7,151
  • 12
  • 44
  • 63
  • I don't see how it can get any simpler than your proposed method. As for scalability, this [StackOverflow question](http://stackoverflow.com/questions/4710420/scaling-node-js) comes to mind. – Michael Tang Nov 27 '13 at 01:31

1 Answers1

0

Essentially, you're describing a reverse proxy, no? And if so, why reinvent the wheel? Nginx will not only provide the reverse proxy functionality, but as your project grows you can leverage it for load balancing between a cluster of node apps. Even if you only have a couple of hosts, when you need to scale your architecture, decoupling each host is the first place you will start. Might as well get ahead of it from the get-go.

As for service providers like Nodejitsu, they use the singularity of a hostname as a means to monetize their service. They don't want you hosting a hosting platform on their own hosting platform =)

srquinn
  • 10,134
  • 2
  • 48
  • 54