Skip to content

Commit

Permalink
Disable HTTP2 by default
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie committed Aug 3, 2020
1 parent 217fd62 commit fe49fa9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ type HTTPClientConfig struct {
ProxyURL URL `yaml:"proxy_url,omitempty"`
// TLSConfig to use to connect to the targets.
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
// EnableHTTP2 enables HTTP2 transport. Not exposed via Yaml to users, as it
// should only be used without persistent connections.
EnableHTTP2 bool `yaml:"-"`
}

// Validate validates the HTTPClientConfig to check only one of BearerToken,
Expand Down Expand Up @@ -154,10 +157,12 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, disableKeepAli
conntrack.DialWithName(name),
),
}
// TODO: use ForceAttemptHTTP2 when we move to Go 1.13+.
err := http2.ConfigureTransport(rt.(*http.Transport))
if err != nil {
return nil, err
if cfg.EnableHTTP2 {
// TODO: use ForceAttemptHTTP2 when we move to Go 1.13+.
err := http2.ConfigureTransport(rt.(*http.Transport))
if err != nil {
return nil, err
}
}

// If a bearer token is provided, create a round tripper that will set the
Expand Down

0 comments on commit fe49fa9

Please sign in to comment.