-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add by location reverse-proxying #5
Comments
Hello! I'm a little confused about this. The current implementation should pass the original request object which will contain a "url" property. Can you explain how this implementation doesn't achieve the functionality you want? Are you talking about parking a router in-front of the reverse proxy so you can dynamically route requests? Could you possibly write a test case or perhaps pseudo code what the api for this would look like? Thanks! |
You're right, certainly it wasn't a good day yesterday ! Anyway I was thinking to a sort of a thin "router" layer on top of that to automate a little bit the process. As an example : if you want to reverse proxy http://www.server.com/foo to http://server1.local/foo , instead of having to :
just have something to predefine route, a bit of code to illustrate :
That way you provide features for common reverse-proxying needs, ex cookie rewriting, load-balancing, encoding ... |
Okay, that makes a lot of sense. The codebase we extracted this from does have a router and (somewhat of a) load balancer. I didn't want to clutter http-proxy api, but you do have a valid point. While having the raw access to httpProxy.proxyRequest() is great, most people will want the more advanced functionality you mentioned. I could write a new router for this, or use a pre-existing one. I'm going to think on this for a few days and determine the best plan of attack. It's important to me that we keep the api clean, but I think there is a good solution to be had here. Hopefully I'll have a patch by next week. In the meantime, do you think you could elaborate on the functionality you mentioned of cookie rewriting and encoding? Thanks a lot for your feedback, it's much appreciated. |
Fixed in 0.3.1: npm install http-proxy@0.3.1 |
http://server.com/foo reversed to http://internal-server1/foo
http://server.com/bar reversed to http://internal-server2/bar
The text was updated successfully, but these errors were encountered: