Skip to content

Commit

Permalink
Support HTTP/2 in Let's Encrypt (go-gitea#16371)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stanthetiger and 6543 authored Jul 13, 2021
1 parent 57ee06f commit 3dba75f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/web_letsencrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
}

tlsConfig := magic.TLSConfig()
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2")

if enableHTTPChallenge {
go func() {
Expand Down
2 changes: 1 addition & 1 deletion modules/graceful/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (srv *Server) ListenAndServe(serve ServeFunction) error {
func (srv *Server) ListenAndServeTLS(certFile, keyFile string, serve ServeFunction) error {
config := &tls.Config{}
if config.NextProtos == nil {
config.NextProtos = []string{"http/1.1"}
config.NextProtos = []string{"h2", "http/1.1"}
}

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

0 comments on commit 3dba75f

Please sign in to comment.