-
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
Cannot change path in target site? #758
Comments
@yleemj use the |
After I set prependPath to false, the problem still exists. Here is my code:
I'm using expressjs. The req.originalUrl is '/user/A', req.baseUrl is '/user', and req.url is '/A'. the request is proxied to http://target.com/A, which doesn't exist. What I really want is http://target.com/. But if I set req.url to '/' manually, the path for the the static files in target server will be changed to '/user/'. E..g, http://target.com/static/app.js will be changed to http://originalSite.com/user/static/app.js. It should be http://originalSite.com/user/A/static/app.js, and then proxied to the target server. |
@yleemj Just for posterity, |
I have the same usecase. I want to run a proxy that forwards to a remote server, but changes the target path: So for eg: http://proxy.com/foo -> http://target.com/bar I have tried ignorePath=true, and prependPath=false and none of them seem to work. Here are my results: prependPath: false, ignorePath: true -> http://target.com/foo How do I get it to forward to just the target Url I specify:
Essentially, I am trying to write a general purpose forwarding proxy, that will use the path of the incoming request to forward to any number of target applications. |
I have the same use case and issue right now. =/ The only way I got this working was to reassign req.url to the path I wanted. |
How and when did you reassign req.url? Could you post some code snippet please? Thank you! |
ignorePath is currently an unmerged PR. @ferozed did you use that branch? Let me merge the pull-request and bump the version and see if this fixes the issue you guys are having. |
please try |
If the income request url is http://example.com/abc, and then we call
the request will be proxied to http://target.com:8080/abc, can it be proxied to a different path, e..g http://target.com:8080/something_else/xxxx, or just http://target.com:8080?
Thanks!
The text was updated successfully, but these errors were encountered: