Replace IPv6 unspecified address for watchdog health checks
This commit is contained in:

committed by
Sebastian Serth

parent
8bcf43702f
commit
39d25d2223
@ -24,6 +24,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
@ -257,7 +258,10 @@ func systemdWatchdogLoop(ctx context.Context, router *mux.Router, interval time.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
healthURL := config.Config.Server.URL().String() + healthRoute.String()
|
healthURL := config.Config.Server.URL().String() + healthRoute.String()
|
||||||
healthURL = strings.ReplaceAll(healthURL, "0.0.0.0", "localhost") // Workaround for certificate subject names
|
|
||||||
|
// Workaround for certificate subject names
|
||||||
|
unspecifiedAddresses := regexp.MustCompile(`0\.0\.0\.0|\[::]`)
|
||||||
|
healthURL = unspecifiedAddresses.ReplaceAllString(healthURL, "localhost")
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
if config.Config.Server.TLS.Active {
|
if config.Config.Server.TLS.Active {
|
||||||
|
Reference in New Issue
Block a user