From 61201a7a52d3de7e01a680fe992b5b8757252103 Mon Sep 17 00:00:00 2001 From: aliasgar Date: Mon, 6 May 2024 10:54:11 +0530 Subject: [PATCH] chore: code format --- modules/caddyhttp/reverseproxy/caddyfile.go | 3 +-- modules/caddyhttp/reverseproxy/healthchecks.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index 84829bdd2eb3..a1634bbeaa0f 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -454,7 +454,7 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { if d.NextArg() { return d.ArgErr() } - h.HealthChecks.Active.HealthFollowRedirects = true + h.HealthChecks.Active.HealthFollowRedirects = true case "health_passes": if !d.NextArg() { @@ -650,7 +650,6 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { h.TrustedProxies = append(h.TrustedProxies, d.Val()) } - case "header_up": var err error diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go index a306a79c4d03..c546033ef9eb 100644 --- a/modules/caddyhttp/reverseproxy/healthchecks.go +++ b/modules/caddyhttp/reverseproxy/healthchecks.go @@ -16,6 +16,7 @@ package reverseproxy import ( "context" + "errors" "fmt" "io" "net" @@ -25,7 +26,6 @@ import ( "runtime/debug" "strconv" "time" - "errors" "go.uber.org/zap" @@ -157,14 +157,14 @@ func (a *ActiveHealthChecks) Provision(ctx caddy.Context, h *Handler) error { a.httpClient = &http.Client{ Timeout: timeout, Transport: h.Transport, - CheckRedirect: func(req *http.Request, via []*http.Request) error { - if !a.HealthFollowRedirects { - return errors.New( - "Redirects are disabled in health check, set health_follow_redirects flag in config to avoid this error") - } else { - return nil - } - }, + CheckRedirect: func(req *http.Request, via []*http.Request) error { + if !a.HealthFollowRedirects { + return errors.New( + "Redirects are disabled in health check, set health_follow_redirects flag in config to avoid this error") + } else { + return nil + } + }, } for _, upstream := range h.Upstreams {