Many HTTP servers #82

Open
purepear opened this Issue Jul 15, 2013 · 4 comments

Projects

None yet

3 participants

@purepear

Currently only the first process in .awsbox.json processes is mapped to port 80(iptable 80 -> 8080 and then node-http-proxy listens on 8080 using process.env.PORT=10000 to proxy you app)...

Can you suggest a way so i can run many applications like:

example.com
admin.example.com
static.example.com

or at least listening on different ports like:
example.com:80
example.com:8001 //for admin
example.com:8002 // for static content

I'm not sure if this is the right place to ask.. i hope so
Thanks

@purepear

What i came up with is replacing proxy_server.js with this:


#!/usr/bin/env node

require('http-proxy').createServer({
hostnameOnly: true,
router: {
example.com': '127.0.0.1:8001',
'admin.example.com': '127.0.0.1:8002'
}
}).listen(8080);


What i can suggest is instead of using just the processes array we can use a http-proxy ProxyTable and load it in proxy_server.js ... but i don't know how the ssl thing is gonna work

@chilts

I do a similar thing in my proximity project whereby multiple domains listen on the same port and are proxied through.

So I'll look into this soon I hope.

On the subject of https, I believe it can be done though it'll depend on SNI being ok with the client (some compatibility stuff here http://en.wikipedia.org/wiki/Server_Name_Indication). Again, I think it's possible to add so I'll take a look. :)

@lloyd

now that we've moved to nginx, what do we think about this issue?

@chilts

I think it sounds like a great feature and much easier with Nginx.

From what I can tell, we loop through the config.processes for each server process we want to start, but this seems to be independent from anything related to Nginx and in fact, independent of services that might be listening externally. Correct me if I'm wrong.

Am I right in thinking that we don't do anything to the Nginx config in users/app/post-update.js (and is it just already set up on the AMI)? I guess we would write a new Nginx server config to sites-available/enabled from post-update.js. This doesn't seem to be a one-to-one mapping of processes, so would we require a new config option, such as hosts or servers or public-processes ... just mashing things out of my head. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment