Skip to content

Commit

Permalink
http(metrics): disallow auto HTTP/2 enablement (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
RTann authored Oct 13, 2023
1 parent 6361a63 commit 4d87d65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/clairify/metrics/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package metrics

import (
"crypto/tls"
"fmt"
"net/http"

Expand Down Expand Up @@ -37,6 +38,8 @@ func NewHTTPServer(config *api.Config) *HTTPServer {
server: &http.Server{
Addr: addr,
Handler: mux,
// Setting TLSNextProto to a non-nil empty map disables automatic HTTP/2 support.
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
},
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/clairify/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ func (s *Server) Start() error {
if err != nil {
return err
}
// This explicitly disables automatic HTTP/2 support.
tlsConfig.NextProtos = nil

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

0 comments on commit 4d87d65

Please sign in to comment.