-
Notifications
You must be signed in to change notification settings - Fork 2k
change proxyTable routing target path #129
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
Conversation
looks good, reviewing. |
well guys I think the documentation is wrong in this regard. According to the documentation in the main page, it does not imply that a route like this 'foo.com/baz': '127.0.0.1:8001', means that requests will be forwarded to 127.0.0.1:8001/baz, in fact it says: incoming requests to 'foo.com/baz' and forward them to '127.0.0.1:8001'. From the Readme: var options = { |
btw, the issue I am referring to is #112 |
@manast if you use node-http-proxy at 4d50915 then that is the behavior that you will get, is that what you want? the first type of proxying could be useful for sharding your app, but foo.com/db: host:port could be useful for sidestepping the single origin policy... which is probably much more useful. |
The reporter is complaining that pizza.com/taco/muffins is proxied to 127.0.0.1:8099/taco instead of to 127.0.0.1:8099/muffins/taco, which according to the documentation are both wrong behaviors, or at least thats my interpretation of what I read. But besides that I think that proxying just to 127.0.0.1:8099 should be the most common use case, i.e., you have several servers and you want to place them under different sub routes (to avoid for instance cross-browser scripting problems, etc). If we keep the subroutes in the proxied request, then we are creating a coupling between the proxy and the servers, both need to be always in sync, which I dont think is a good idea. Every server should be agnostic of where the proxy configurator has placed it... var options = {
router: {
'foo.com/baz': '127.0.0.1:8001/baz',
'foo.com/buz': '127.0.0.1:8002/buz',
'bar.com/buz': '127.0.0.1:8003/buz'
}
}; ? |
On top of everything I am also a bit confused about how to use the proxy in conjunction with socket.io+express. Before, everything worked without any hassle, but now I am not sure If I need to do something else or not :/ |
@manast I like the subroutes API you defined, it seems more robust than my solution, which is more robust than what used to be in node-http-proxy. If you make a pull request to support your suggestion then I'd be happy to use it. |
guys, it may be me, but what is now on the repo is not working at all. For example, If I defined a route like this: "pizza.com/taco/muffins": "127.0.0.1:8099" and I get the following incoming request: pizza.com/taco/muffins/tomato I should expect (according to the latest merge): Of course I would have preferred 127.0.0.1:8099/tomato Strange that I just can't add a new case :/ regards. |
given a proxyTable router like this:
requests from
baz.com/taco
will get proxied to127.0.0.1:8098
and requests frompizza.com/taco/muffins
will get proxied to127.0.0.1:8099/taco
the old behavior was
baz.com/taco
to127.0.0.1:8098/taco
andpizza.com/taco/muffins
to127.0.0.1:8099/taco/muffins