On Sep 8, 2015, at 1:08 PM, Aaron Martone wrote:

> I'm looking to build an infrastructure that allows me to handle routing all 
> incoming requests through a central "AppRouter" that looks at the Protocol, 
> Domain and Port combination (what I'm calling an 'endpoint') to know which 
> app to route the request off to. For example, if it sees:
> 
> https://www.domain.com/this/that,
> 
> it'll know that: "With protocol 'https' and domain 'www.domain.com' and port: 
> 80, I send this to the 'Default website' express app (which takes over from 
> that point to process the '/this/that' or remainder of the path in the url.
> 
> My problem I'm encountering, is that in order to bring up a 'AppRouter' 
> application, I have to specify a port to bind to. So if I bind it to port 80, 
> I'll miss all requests on https (443) or other ports I might want to support.

An express app can be made to listen on multiple ports. You can listen both on 
port 80 and on port 443.

Alternately, your node app could listen on a single http port, and you could 
use another server in front of it (like nginx) that listens on both ports 80 
and 443 and proxies requests on either port to your node app.

You may even find that a server like nginx in front of your "real" node apps 
already fits your needs and you don't need to write a separate "AppRouter".

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/9902FC03-3743-4705-AA50-55A226E98489%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to