Skip to content

Commit

Permalink
Add the ability to disable HTTP/2
Browse files Browse the repository at this point in the history
I have noticed that HTTP/2 tends to be unreliable in certain
circumstances due to bugs in Go's HTTP/2 library. See the following
upstream issues:

golang/go#36026
golang/go#59690

Let's add a configuration option here, so that HTTP/2 can be disabled on
an individual basis if needed.
  • Loading branch information
EdSchouten committed Aug 30, 2023
1 parent 34e3e8d commit 4f2d039
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 86 deletions.
2 changes: 1 addition & 1 deletion pkg/http/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewRoundTripperFromConfiguration(configuration *pb.ClientConfiguration) (ht
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
ForceAttemptHTTP2: !configuration.DisableHttp2,
TLSClientConfig: tlsConfig,
}
if proxyURL := configuration.GetProxyUrl(); proxyURL != "" {
Expand Down
180 changes: 95 additions & 85 deletions pkg/proto/configuration/http/http.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions pkg/proto/configuration/http/http.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ message ClientConfiguration {
//
// "Basic " + std.base64(username + ":" + password)
repeated HeaderValues add_headers = 5;

// Use HTTP/1.1, even if the server supports HTTP/2.
//
// This option can be used to work around HTTP client or server bugs.
// For example, the following bug in Go's HTTP/2 client may cause
// requests to be sent across network connections that are known to be
// unresponsive, leading to request timeouts:
//
// https://github.com/golang/go/issues/36026
// https://github.com/golang/go/issues/59690
bool disable_http2 = 6;
}

message ServerConfiguration {
Expand Down

0 comments on commit 4f2d039

Please sign in to comment.