mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-29 15:12:45 +00:00
[bugfix] Fix server trying to listen twice on same address when l.e. enabled (#557)
This commit is contained in:
parent
8e30671a62
commit
898d256511
|
@ -91,10 +91,6 @@ func (r *router) Start() {
|
||||||
http.Redirect(rw, r, target, http.StatusTemporaryRedirect)
|
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.
|
// Start the LetsEncrypt autocert manager HTTP server.
|
||||||
go func() {
|
go func() {
|
||||||
addr := fmt.Sprintf("%s:%d",
|
addr := fmt.Sprintf("%s:%d",
|
||||||
|
@ -103,8 +99,7 @@ func (r *router) Start() {
|
||||||
)
|
)
|
||||||
|
|
||||||
logrus.Infof("letsencrypt listening on %s", addr)
|
logrus.Infof("letsencrypt listening on %s", addr)
|
||||||
|
if err := http.ListenAndServe(addr, r.certManager.HTTPHandler(redirect)); err != nil &&
|
||||||
if err := srv.ListenAndServe(); err != nil &&
|
|
||||||
err != http.ErrServerClosed {
|
err != http.ErrServerClosed {
|
||||||
logrus.Fatalf("letsencrypt: listen: %s", err)
|
logrus.Fatalf("letsencrypt: listen: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue