Skip to content
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

/endpoint gets proxied to /endpoint/ #43

Open
0xR opened this issue Sep 7, 2015 · 9 comments
Open

/endpoint gets proxied to /endpoint/ #43

0xR opened this issue Sep 7, 2015 · 9 comments

Comments

@0xR
Copy link

0xR commented Sep 7, 2015

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.

@jlank
Copy link
Contributor

jlank commented Oct 23, 2015

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?

jlank added a commit to jlank/node-proxy-middleware that referenced this issue Oct 23, 2015
…L if they are already there, if they aren't there, we don't want to add it. This PR adds logic to handle this properly. Please see issue gonzalocasas#43 for reference
@andrewrk
Copy link
Collaborator

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.

@jlank
Copy link
Contributor

jlank commented Oct 23, 2015

my PR broke the tests; working on fixing that now. I'll let you know when they're up to snuff, thanks!

@jlank
Copy link
Contributor

jlank commented Oct 24, 2015

this issue can be closed, fix landed in v0.15.0 d3f462e

@jlank
Copy link
Contributor

jlank commented Oct 24, 2015

jeez, feel stupid here, but when I fixed the tests I somehow reverted my fix ... 👎

let's keep this open, sending another PR - its been a long week!

@0xR
Copy link
Author

0xR commented Oct 24, 2015

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.

@koga73
Copy link

koga73 commented Nov 2, 2015

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?

@Pyo25
Copy link

Pyo25 commented Jul 12, 2016

@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.

@WLyKan
Copy link

WLyKan commented Dec 22, 2016

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants