mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
Use timeout in lets encrypt http server
This commit is contained in:
parent
7a78314d9d
commit
434747e007
1 changed files with 10 additions and 1 deletions
11
app.go
11
app.go
|
@ -820,10 +820,19 @@ func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
||||||
// Configuration via autocert with HTTP-01. This requires listening on
|
// Configuration via autocert with HTTP-01. This requires listening on
|
||||||
// port 80 for the certificate validation in addition to the headscale
|
// port 80 for the certificate validation in addition to the headscale
|
||||||
// service, which can be configured to run on any other port.
|
// service, which can be configured to run on any other port.
|
||||||
|
|
||||||
|
server := &http.Server{
|
||||||
|
Addr: h.cfg.TLS.LetsEncrypt.Listen,
|
||||||
|
Handler: certManager.HTTPHandler(http.HandlerFunc(h.redirect)),
|
||||||
|
ReadTimeout: HTTPReadTimeout,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := server.ListenAndServe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Fatal().
|
log.Fatal().
|
||||||
Caller().
|
Caller().
|
||||||
Err(http.ListenAndServe(h.cfg.TLS.LetsEncrypt.Listen, certManager.HTTPHandler(http.HandlerFunc(h.redirect)))).
|
Err(err).
|
||||||
Msg("failed to set up a HTTP server")
|
Msg("failed to set up a HTTP server")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue