Skip to content

A way to add new routes? #60

Closed
Qard opened this Issue Jun 10, 2011 · 7 comments

5 participants

@Qard
Qard commented Jun 10, 2011

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);
proxy.addHost('username.example.com', '127.0.0.1:9000');

@Marak
Marak commented Jun 10, 2011

@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?

@Qard
Qard commented Jun 10, 2011

No problem, that'll work for now. I might take a crack at it on the weekend, if I can find the time.

@Marak
Marak commented Jun 10, 2011

Cool! Even if you can post an attempt, I'm sure it would help guide the next person who wants to implement this :-)

@ghost
ghost commented Jul 18, 2011

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??

@Irrelon
Irrelon commented Jul 19, 2011

Agreed, that would rock. I'm gonna see if I can code this now...

@Irrelon
Irrelon commented Jul 25, 2011

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/

@tglines
tglines commented Feb 14, 2012

I submitted a pull request for an attempt following the style you guys were looking for here:

#195

@indexzero indexzero added a commit that closed this issue Mar 9, 2013
@indexzero indexzero [api test] Manually merge #195 from @tglines since that fork was dele…
…ted. Update tests to use new macros. Fixes #195. Fixes #60.
5d515e4
@indexzero indexzero closed this in 5d515e4 Mar 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.