Skip to content

Commit

Permalink
[bugfix] Fix server trying to listen twice on same address when l.e. …
Browse files Browse the repository at this point in the history
…enabled (#557)
  • Loading branch information
tsmethurst committed May 12, 2022
1 parent 8e30671 commit 898d256
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
}
Expand Down

0 comments on commit 898d256

Please sign in to comment.