node-proxy-middleware
node-proxy-middleware copied to clipboard
/endpoint gets proxied to /endpoint/
I have an endpoint /endpoint
which I want to proxy to, however all my requests get redirected to /endpoint/
which doesn't exist.
It is set up like so:
app.use('/endpoint', proxy('http://somehost.com/endpoint'));
The error seems to be somewhere in slashJoin
in index.js
.
Running into this issue as well. @0xR you have a PR lined up? If not I'll see if I can make the change. @andrewrk what are your thoughts on this?
My thoughts:
I don't write code for this module any more. I'm pretty sure the first version I released didn't have this problem. I just merge pull requests if the tests pass and cut releases. It's an experiment in a community maintained module.
my PR broke the tests; working on fixing that now. I'll let you know when they're up to snuff, thanks!
this issue can be closed, fix landed in v0.15.0 d3f462e23d4dda4483fac601649bec33735548f1
jeez, feel stupid here, but when I fixed the tests I somehow reverted my fix ... :-1:
let's keep this open, sending another PR - its been a long week!
Thanks for making a fix. Instead of spending time making a PR I just switched to express-http-proxy
. Good luck on recreating the fix though haha.
We are experiencing the same issue. This module is used in ionic and our proxies pointing to /endpoint are redirecting to /endpoint/ causing an issue. Are there any other workarounds?
@koga73 I know it's late, but there is a workaround using the route
option:
var url = require('url');
var options = url.parse('http://www.website.com');
options.pathname = '/endpoint';
options.route = '/api/endpoint';
app.use(proxy(options));
// redirect /api/endpoint to http://www.website.com/endpoint
This is possible thanks to the url rewriting made with this route
option.
@Pyo25 i think it's not the same question
app.use('/api/endpoint', proxy('http://somehost.com/endpoint'));
i'm facing the problem,when
app.use('/sampath', proxy('http://somehost.com/sampath'));
it goes into
Error: connect ENOBUFS
10.10.1.183:9527 - Local (undefined:undefined)