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

Ignore path and the trailing slash #839

Closed
mereghost opened this issue Jun 10, 2015 · 8 comments
Closed

Ignore path and the trailing slash #839

mereghost opened this issue Jun 10, 2015 · 8 comments

Comments

@mereghost
Copy link

As I need to rewrite the request URL as it does not map perfectly to the applications under the proxy, I've set ignorePath to true.

Then I proceeded to define the target as a full doctored url (a valid URL for my applications), but as in common.js:82 it does not truly ignore the path. It sets it to '/' and them proceeds to append it to target / forward.

Is there any way around that? Is there a better way to do what I need?

@mereghost
Copy link
Author

Hmmm... the only current way (that I found) to bypass this behavior is rewriting the proxied request path using the callback 'proxyReq'

proxy.on('proxyReq', function (proxyReq, req, res, options) {
    proxyReq.path = path;
});

@bdefore
Copy link

bdefore commented Aug 5, 2015

thanks @mereghost i was looking for just this. to prepend, you can do i.e. proxyReq.path = '/api/' + proxyReq.path. certainly would be nicer if ignorePath was better documented.

@cdl
Copy link

cdl commented Aug 19, 2015

Thanks @mereghost - just ran into this issue myself, but it didn't surface until dealing with proxying requests with query parameters. Glad to see I'm not going insane. 👍

@RickWong
Copy link

👍

@darrenmce
Copy link

👍 / appended to end of querystring when using ignorePath

@75lb
Copy link

75lb commented Nov 14, 2015

i need to rewrite the target path too for the exact same reason (the target URL structure does not match the source URL structure).

this appended trailing slash breaks the ability to rewrite the target path as a specific resource.. could we remove it and update the docs for ignorePath stating that, if required, we must manually append our own target trailing slash?

jcrugzz added a commit that referenced this issue Jan 26, 2016
Fix for #839 (Ignore path and the trailing slash)
@niclic
Copy link

niclic commented Jan 28, 2016

Should be resolved by this: #934

@jcrugzz
Copy link
Contributor

jcrugzz commented Jan 28, 2016

@niclic should be, thanks :)

@jcrugzz jcrugzz closed this as completed Jan 28, 2016
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

8 participants