Say I have a server at example.com and each time a user signs up I want to spin up a new node process that maps to username.example.com, is there an easy way to add this to the route list if I'm using hostname routing, or will I need to just use the custom logic mode?
I'm thinking it'd be handy to be able to do something like this;
var proxy = httpProxy.createServer(options);
@qard I think it might make the most sense to use the custom logic mode for now.
If you do really like this sugar sytnax, I think we would accept a pull request for it. You want to try a few commits to get it started?
No problem, that'll work for now. I might take a crack at it on the weekend, if I can find the time.
Cool! Even if you can post an attempt, I'm sure it would help guide the next person who wants to implement this :-)
Yeah I would also be interested by such a feature, actualy having both addHost and removeHost would make it really easier to adapt this proxy to a changing server environment... Some news about it??
Agreed, that would rock. I'm gonna see if I can code this now...
I've created a system that allows you to do this now. It uses node-http-proxy and allows on-the-fly updates to the routing table without having to shutdown and restart the service: http://www.isogenicengine.com/2011/07/25/node-js-domain-to-hostport-router/
I submitted a pull request for an attempt following the style you guys were looking for here:
[api test] Manually merge #195 from @tglines since that fork was dele…
…ted. Update tests to use new macros. Fixes #195. Fixes #60.