From 7610aa40bf7ec9c886f9442aa1bf79a0e17f4352 Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 28 Apr 2026 10:10:28 -0700 Subject: [PATCH] Follow redirects by default for backward compat Fixes #330 --- healthcheck/healthcheck.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/healthcheck/healthcheck.go b/healthcheck/healthcheck.go index 0f3a039..d75797e 100644 --- a/healthcheck/healthcheck.go +++ b/healthcheck/healthcheck.go @@ -47,7 +47,7 @@ type Config struct { Interval int `json:"hcInterval"` // in seconds UnhealthyInterval int `json:"hcUnhealthyInterval"` // in seconds Timeout int `json:"hcTimeout"` // in seconds - FollowRedirects bool `json:"hcFollowRedirects"` + FollowRedirects *bool `json:"hcFollowRedirects"` Headers map[string]string `json:"hcHeaders"` Method string `json:"hcMethod"` Status int `json:"hcStatus"` // HTTP status code @@ -202,7 +202,9 @@ func (m *Monitor) addTargetUnsafe(config Config) error { cancel: cancel, client: &http.Client{ CheckRedirect: func() func(*http.Request, []*http.Request) error { - if !config.FollowRedirects { + // Default to following redirects if not explicitly configured + followRedirects := config.FollowRedirects == nil || *config.FollowRedirects + if !followRedirects { return func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }