Skip to content

Commit 611bf70

Browse files
committed
devapp: add acme.ALPNProto to NextProtos
We need to add this manually in order to enable the tls-alpn-01 challenge, since we're using GetCertificate directly instead of via Manager.TLSConfig. We also don't have the http-01 challenge enabled (HTTPHandler isn't being used), so this is the only way for a Let's Encrypt certificate to be acquired now that tls-sni-* challenges have been deprecated. In the future, this code can probably be simplified by using higher-level APIs of autocert, but this fixes the immediate issue. Updates golang/go#32272 Change-Id: Ia72bca3e44bc585b0dfe5c7bcd3e4f544272d1ab Reviewed-on: https://go-review.googlesource.com/c/build/+/179097 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 78beebf commit 611bf70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

devapp/devapp.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
"cloud.google.com/go/storage"
2626
"golang.org/x/build/autocertcache"
27+
"golang.org/x/crypto/acme"
2728
"golang.org/x/crypto/acme/autocert"
2829
"golang.org/x/net/http2"
2930
)
@@ -134,7 +135,10 @@ func serveAutocertTLS(h http.Handler, bucket string) error {
134135
}
135136
config := &tls.Config{
136137
GetCertificate: m.GetCertificate,
137-
NextProtos: []string{"h2", "http/1.1"},
138+
NextProtos: []string{
139+
"h2", "http/1.1", // enable HTTP/2
140+
acme.ALPNProto, // enable tls-alpn ACME challenges
141+
},
138142
}
139143
tlsLn := tls.NewListener(tcpKeepAliveListener{ln.(*net.TCPListener)}, config)
140144
server := &http.Server{

0 commit comments

Comments
 (0)