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 <6543@obermui.de>release/v1.15
parent
57ee06fb94
commit
3dba75fb97
|
@ -54,6 +54,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
tlsConfig := magic.TLSConfig()
|
tlsConfig := magic.TLSConfig()
|
||||||
|
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2")
|
||||||
|
|
||||||
if enableHTTPChallenge {
|
if enableHTTPChallenge {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (srv *Server) ListenAndServe(serve ServeFunction) error {
|
||||||
func (srv *Server) ListenAndServeTLS(certFile, keyFile string, serve ServeFunction) error {
|
func (srv *Server) ListenAndServeTLS(certFile, keyFile string, serve ServeFunction) error {
|
||||||
config := &tls.Config{}
|
config := &tls.Config{}
|
||||||
if config.NextProtos == nil {
|
if config.NextProtos == nil {
|
||||||
config.NextProtos = []string{"http/1.1"}
|
config.NextProtos = []string{"h2", "http/1.1"}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Certificates = make([]tls.Certificate, 1)
|
config.Certificates = make([]tls.Certificate, 1)
|
||||||
|
|
Loading…
Reference in New Issue