Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to add new routes? #60

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

A way to add new routes? #60

Qard opened this issue Jun 10, 2011 · 7 comments

Comments

@Qard
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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
Copy link

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
Copy link

Irrelon commented Jul 19, 2011

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

@Irrelon
Copy link

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:https://www.isogenicengine.com/2011/07/25/node-js-domain-to-hostport-router/

@tglines
Copy link

tglines commented Feb 14, 2012

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

#195

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

No branches or pull requests

5 participants