I switched SSL on, with ListenAndServeTLS
func main() {
serverMux := http.NewServeMux()
serverMux.HandleFunc("/v1/ws1", handler1)
serverMux.HandleFunc("/v1/ws2", handler2)
serverMux.HandleFunc("/v1/ws3", handler3)
serverMux.HandleFunc("/static/", handlerStatic(http.FileServer(http.Dir("/var/project/"))))
go func() {
wsSSLServer := &http.Server{
Addr: ":443",
Handler: serverMux,
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
}
certPath := "/etc/letsencrypt/live/example.com/"
fmt.Println(wsSSLServer.ListenAndServeTLS(certPath+"fullchain.pem", certPath+"privkey.pem"))
}()
wsServer := &http.Server{
Addr: ":80",
Handler: serverMux,
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
}
fmt.Println(wsServer.ListenAndServe())
}
and now I get lots of these errors in the logs:
http2: server: error reading preface from client x.x.x.x:xxxxx: timeout waiting for client preface
what does it mean?