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

resolver with path bug #281

Open
pcnate opened this issue Sep 13, 2022 · 1 comment
Open

resolver with path bug #281

pcnate opened this issue Sep 13, 2022 · 1 comment

Comments

@pcnate
Copy link

pcnate commented Sep 13, 2022

I think there is a bug in how the path is removed from the URL. In the code below we can see it trying to take the length of the pathname off of the beginning of the request.url property.

redbird/lib/proxy.js

Lines 646 to 653 in cb7781e

var pathname = route.path;
if (pathname.length > 1) {
//
// remove prefix from src
//
req._url = url; // save original url
req.url = url.substr(pathname.length) || '';
}

If I am not mistaken, that means returning the path of /test in your resolver will result in the request.url having http removed from the beginning instead of the end.

@pcnate
Copy link
Author

pcnate commented Sep 13, 2022

So, I learned that path is not the path you want to redirect to but the piece of the current path that you would like to remove.

Not what I was expecting and not really what I think is best but I got it working nonetheless

Say your resolver received a URL of http://bestwebsite.com/test/sthaoesuthsau?aoeuaoeu=sthst

You could return { url: 'http://localhost', path: '/test' } from the resolver to redirect it to http://localhost/sthaoesuthsau?aoeuaoeu=sthst

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

1 participant