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

Fix body proxying, redirect proxying and add tests #2609

Merged
merged 3 commits into from
Feb 1, 2021
Merged

Conversation

nhooyr
Copy link
Contributor

@nhooyr nhooyr commented Jan 20, 2021

Closes #2377

@nhooyr nhooyr added this to the v3.8.1 milestone Jan 20, 2021
@nhooyr nhooyr requested a review from code-asher January 20, 2021 22:42
@nhooyr nhooyr mentioned this pull request Jan 20, 2021
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

This breaks --proxy-path-passthrough

However, we still need this when that code is disabled as many apps will
issue absolute redirects and expect the proxy to rewrite as appropriate.

e.g. Go's http.Redirect will rewrite relative redirects as absolute!
See https://golang.org/pkg/net/http/#Redirect
Any json or urlencoded request bodies were being consumed by body-parser
before they could be proxied. That's why requests without Content-Type
were proxied correctly as body-parser would not consume their body.

This allows the http-proxy package to passthrough the request body correctly
in all instances.

Closes #2377
@nhooyr nhooyr merged commit 966e9cc into master Feb 1, 2021
@nhooyr nhooyr deleted the proxy-res-d629 branch February 1, 2021 16:39
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

Successfully merging this pull request may close these issues.

2 participants