-
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 https://target.com/A, which doesn't exist. What I really want is https://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, https://target.com/static/app.js will be changed to https://originalSite.com/user/static/app.js. It should be https://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: https://proxy.com/foo -> https://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 -> https://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 https://example.com/abc, and then we call
the request will be proxied to https://target.com:8080/abc, can it be proxied to a different path, e..g https://target.com:8080/something_else/xxxx, or just https://target.com:8080?
Thanks!
The text was updated successfully, but these errors were encountered: