redbird icon indicating copy to clipboard operation
redbird copied to clipboard

resolver with path bug

Open pcnate opened this issue 3 years ago • 1 comments

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.

https://github.com/OptimalBits/redbird/blob/cb7781e9c471bcb497ea4af1ddabf4fdf4432caa/lib/proxy.js#L646-L653

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 avatar Sep 13 '22 15:09 pcnate

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

pcnate avatar Sep 13 '22 23:09 pcnate