[bugfix] Fix server trying to listen twice on same address when l.e. enabled (#557)

This commit is contained in:
tobi 2022-05-12 11:35:36 +02:00 committed by GitHub
parent 8e30671a62
commit 898d256511
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,10 +91,6 @@ func (r *router) Start() {
http.Redirect(rw, r, target, http.StatusTemporaryRedirect)
})
// Clone HTTP server but with autocert handler
srv := r.srv
srv.Handler = r.certManager.HTTPHandler(redirect)
// Start the LetsEncrypt autocert manager HTTP server.
go func() {
addr := fmt.Sprintf("%s:%d",
@ -103,8 +99,7 @@ func (r *router) Start() {
)
logrus.Infof("letsencrypt listening on %s", addr)
if err := srv.ListenAndServe(); err != nil &&
if err := http.ListenAndServe(addr, r.certManager.HTTPHandler(redirect)); err != nil &&
err != http.ErrServerClosed {
logrus.Fatalf("letsencrypt: listen: %s", err)
}