log.Println("sslHosts:", sslHosts)
log.Println("sslCertDir:", sslCertDir)
certManager := autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist(strings.Split(sslHosts, " ")...),
Cache: autocert.DirCache(sslCertDir),
}
go func() {
log.Fatal(http.ListenAndServe(":http", certManager.HTTPHandler(nil)))
}()
// go log.Fatal(http.ListenAndServe(":http", certManager.HTTPHandler(nil)))
s.Addr = ":https"
s.TLSConfig = certManager.TLSConfig()
log.Fatal(s.ListenAndServeTLS("", ""))
Once I remove the go func() and uncomment the // go log line, the server no longer serves HTTPS requests while HTTP continues to work.
I'm totally stumped- the two go funcs should imho be equivalent? Any insight what's wrong here would be highly appreciated.
I'm using go 1.16.3-arm64 on Darwin, cross-compiled to amd64.
Cheers,
Andi