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

http->https 302 redirects are improperly rewritten #192

Closed
quartzjer opened this issue Feb 10, 2012 · 9 comments
Closed

http->https 302 redirects are improperly rewritten #192

quartzjer opened this issue Feb 10, 2012 · 9 comments

Comments

@quartzjer
Copy link

The pull req #165 introduced broken logic, it rewrites every redirect, such that if a proxied services 302's any url (in our instance, our https-fronted and http-back-end sends a redirect to instagram's http cdn).

https://github.com/elfsternberg/node-http-proxy/blob/411bb51cc6/lib/node-http-proxy/http-proxy.js#L216

It rewrites every single redirect regardless :(

@abh
Copy link

abh commented Feb 11, 2012

It also breaks redirects to other protocols (however uncommon that is).

@indexzero
Copy link
Contributor

@quartzjer How would you go about fixing it? Honestly I'm not sure I follow what's wrong.

@quartzjer
Copy link
Author

If there's a front-end of https://external/ and a back-end of http://internal/ when the back-end sends a redirect to http://some-other-site.com/foo.bar this code will rewrite it to https://sime-other-site.com/foo.bar, which is generally a bad thing to be rewriting every redirect :)

I honestly don't understand the original issue to suggest a fix as I'm not sure what the desired behavior would be, all I know is the current one is not desirable.

@quartzjer
Copy link
Author

Is there any way this can be fixed in master? I'm (undesirably) using a fork that just has this code commented out, and I don't know how this condition isn't horribly broken for everyone, every single redirect response is rewritten in this case.

@ovaillancourt
Copy link

+1

@quartzjer -> You could create a clean pull request from that fork to accelerate the fix.

@quartzjer
Copy link
Author

I would, but I don't know what the problem is actually being solved so
I just commented it out :)

On Thu, Mar 15, 2012 at 4:59 PM, Olivier Vaillancourt
reply@reply.github.com
wrote:

+1

@quartzjer -> You could create a clean fix + pull request from that fork to accelerate the fix.


Reply to this email directly or view it on GitHub:
#192 (comment)

@ovaillancourt
Copy link

Yeah, looking at it, these lines (those commented out) do solve the specific problem of the user that submitted the fix but I'm pretty sure it's not really a desirable behaviour for a proxy...

You pretty much irreversibly loose control over your protocol with this "fix". I think it should either be configurable in the proxy or managed on the app side.

We're running an internal build of http-proxy that has the exact same lines commented out :P.

@mansona
Copy link

mansona commented Jul 24, 2012

Has there been any update on this issue?

@indexzero
Copy link
Contributor

Should be fixed in 6a278b3

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

5 participants