Skip to content

Commit

Permalink
chore: code format
Browse files Browse the repository at this point in the history
  • Loading branch information
aliasgar authored and aliasgar55 committed May 6, 2024
1 parent 86ef3a7 commit 61201a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions modules/caddyhttp/reverseproxy/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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

Expand Down
18 changes: 9 additions & 9 deletions modules/caddyhttp/reverseproxy/healthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package reverseproxy

import (
"context"
"errors"
"fmt"
"io"
"net"
Expand All @@ -25,7 +26,6 @@ import (
"runtime/debug"
"strconv"
"time"
"errors"

"go.uber.org/zap"

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 61201a7

Please sign in to comment.