Skip to content

Commit 3dba75f

Browse files
stanthetiger6543
andauthored
Support HTTP/2 in Let's Encrypt (#16371)
Modify the tlsConfig.NextProtos for Let's Encrypt and built-in HTTPS server in order to support HTTP/2. Co-authored-by: 6543 <[email protected]>
1 parent 57ee06f commit 3dba75f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

cmd/web_letsencrypt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
5454
}
5555

5656
tlsConfig := magic.TLSConfig()
57+
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2")
5758

5859
if enableHTTPChallenge {
5960
go func() {

modules/graceful/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (srv *Server) ListenAndServe(serve ServeFunction) error {
106106
func (srv *Server) ListenAndServeTLS(certFile, keyFile string, serve ServeFunction) error {
107107
config := &tls.Config{}
108108
if config.NextProtos == nil {
109-
config.NextProtos = []string{"http/1.1"}
109+
config.NextProtos = []string{"h2", "http/1.1"}
110110
}
111111

112112
config.Certificates = make([]tls.Certificate, 1)

0 commit comments

Comments
 (0)