|
|
@@ -19,6 +19,8 @@ import (
|
|
|
"net/http"
|
|
|
"strings"
|
|
|
"time"
|
|
|
+
|
|
|
+ "golang.org/x/net/http2"
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
@@ -42,6 +44,14 @@ type GetProxyURLs func() []string
|
|
|
// which will proxy requests to an etcd cluster.
|
|
|
// The handler will periodically update its view of the cluster.
|
|
|
func NewHandler(t *http.Transport, urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) http.Handler {
|
|
|
+ if t.TLSClientConfig != nil {
|
|
|
+ // Enable http2, see Issue 5033.
|
|
|
+ err := http2.ConfigureTransport(t)
|
|
|
+ if err != nil {
|
|
|
+ plog.Infof("Error enabling Transport HTTP/2 support: %v", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
p := &reverseProxy{
|
|
|
director: newDirector(urlsFunc, failureWait, refreshInterval),
|
|
|
transport: t,
|