Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's quite difficult to answer this without knowing the constraints that meant you <strong>must</strong> run the hosts in the same process, so I'll echo what others have said, but hopefully give some more context. </p> <p>The "most correct" thing to do with node is to run the hosts in multiple processes and to reverse proxy the requests in another process. Running multiple sites in the same process is riddled with problems, not least of which is a crash in one, brings them all down and requires a restart of the whole process. Node's philosophy is very unix-like, it encourages keeping programs small and separate. If you separate the processes, you'll get a natural segregation of applications. If you pursue a monolithic design, you'll have to write and maintain logic to separate logging from the different sites and error handling logic will become more complicated. There are no doubt other cases where you'll need to branch logic based on host, but your application design will encourage rather than discourage that.</p> <p>If you're averse to other technology stacks (or are concerned e.g. by nginx's current lack of support of websockets in the stable branch), then there are a few solid reverse proxys written in nodejs, including nodejitsu's <a href="https://github.com/nodejitsu/node-http-proxy" rel="nofollow">http-proxy</a> which is used in their production PaaS stack on Joyent's cloud and <a href="https://github.com/substack/bouncy" rel="nofollow">bouncy</a> (mentioned in another answer) which has less features, but I believe is being used in production on browserling.</p> <p>The author of bouncy actually goes as far as suggesting it as <a href="http://www.quora.com/What-are-some-best-architecture-practices-when-designing-a-nodejs-system" rel="nofollow">one of the most important architectural patterns in designing a nodejs system</a>. You may also notice that his answer has been upvoted by some of the core node committers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload