Skip to content

Commit 4d87d65

Browse files
authored
http(metrics): disallow auto HTTP/2 enablement (#1297)
1 parent 6361a63 commit 4d87d65

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/clairify/metrics/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package metrics
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"net/http"
67

@@ -37,6 +38,8 @@ func NewHTTPServer(config *api.Config) *HTTPServer {
3738
server: &http.Server{
3839
Addr: addr,
3940
Handler: mux,
41+
// Setting TLSNextProto to a non-nil empty map disables automatic HTTP/2 support.
42+
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
4043
},
4144
}
4245
}

pkg/clairify/server/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ func (s *Server) Start() error {
306306
if err != nil {
307307
return err
308308
}
309+
// This explicitly disables automatic HTTP/2 support.
309310
tlsConfig.NextProtos = nil
310311

311312
listener, err = tls.Listen("tcp", s.endpoint, tlsConfig)

0 commit comments

Comments
 (0)