-
Stopped working for me, and now just getting loads of TLS errors: |
Beta Was this translation helpful? Give feedback.
Answered by
aldas
Feb 4, 2022
Replies: 1 comment 2 replies
-
Probably belongs to https://github.com/golang/crypto as Echo uses it for autocert stuff This is example without Echo.StartTLS and allows you complete control over http.Server and cert manager func main() {
e := echo.New()
e.Use(middleware.Recover())
e.Use(middleware.Logger())
e.GET("/", func(c echo.Context) error {
return c.HTML(http.StatusOK, `
<h1>Welcome to Echo!</h1>
<h3>TLS certificates automatically installed from Let's Encrypt :)</h3>
`)
})
autoTLSManager := autocert.Manager{
Prompt: autocert.AcceptTOS,
// Cache certificates to avoid issues with rate limits (https://letsencrypt.org/docs/rate-limits)
Cache: autocert.DirCache("/var/www/.cache"),
//HostPolicy: autocert.HostWhitelist("<DOMAIN>"),
}
s := http.Server{
Addr: ":443",
Handler: e, // set Echo as handler
TLSConfig: &tls.Config{
//Certificates: nil, // <-- s.ListenAndServeTLS will populate this field
GetCertificate: autoTLSManager.GetCertificate,
NextProtos: []string{acme.ALPNProto},
},
//ReadTimeout: 30 * time.Second, // use custom timeouts
}
if err := s.ListenAndServeTLS("", ""); err != http.ErrServerClosed {
e.Logger.Fatal(err)
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
zacpod
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably belongs to https://github.com/golang/crypto as Echo uses it for autocert stuff
This is example without Echo.StartTLS and allows you complete control over http.Server and cert manager