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
net/http/httputil: support for HTTP/2 in ReverseProxy #16696
Comments
No reason I recall. I think it was just muscle memory when I wrote it. |
I started digging into this, and can't seem to write a test that has an HTTP/2 enabled client. The problem is that HTTP/2 is disabled on all clients that set So, I can't seem to figure out how to get a HTTP/2 enabled client inside a test in But maybe there's something I missed? |
(edited last comment to be more clear) |
Actually, the hard-coding of the fields is pointless. From the docs: https://golang.org/pkg/net/http/#Request
And I saw another bug where people were using ReverseProxy with HTTP/2 just fine. (But that wasn't the point of the bug, IIRC). So I think there's nothing to do here. I'll remove those lines from the ReverseProxy code, though. |
CL https://golang.org/cl/28412 mentions this issue. |
…ible The http.Transport's retry can't retry requests with non-nil bodies. When cloning an incoming server request into an outgoing client request, nil out the Body field if the ContentLength is 0. (For server requests, Body is always non-nil, even for GET, HEAD, etc.) Also, don't use the deprecated CancelRequest and use Context instead. And don't set Proto, ProtoMajor, ProtoMinor. Those are ignored in client requests, which was probably a later documentation clarification. Fixes #16036 Updates #16696 (remove useless Proto lines) Change-Id: I70a869e9bd4bf240c5838e82fb5aa695a539b343 Reviewed-on: https://go-review.googlesource.com/28412 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Currently,
httputil.ReverseProxy
hardcodes the HTTP/1.1 protocol in requests going to the backend service. It would be nice if it could support HTTP/2.That hardcoding seems to have been around since the beginning of reverseproxy.go's existence, so I'm not sure if there are real constraints such that ReverseProxy can't be allowed to use the usual net/http HTTP protocol version detection or if this was just some dregs.
The text was updated successfully, but these errors were encountered: