-
I am trying to disable TLS 1.0 and 1.1, |
Beta Was this translation helpful? Give feedback.
Answered by
aldas
Feb 24, 2023
Replies: 1 comment
-
Echo docs have example for autoTLS https://echo.labstack.com/cookbook/auto-tls/#server see I would recommend using 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.
0 replies
Answer selected by
eranchetz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Echo docs have example for autoTLS https://echo.labstack.com/cookbook/auto-tls/#server see
customHTTPServer
function thereI would recommend using
http.Server
+autocert.Manager
as it allows you to customize more aspects of server.