Skip to content

Commit

Permalink
changed reverse proxy health check status code range to be between 20…
Browse files Browse the repository at this point in the history
…0-299
  • Loading branch information
aliasgar55 committed May 7, 2024
1 parent d6ee591 commit 5ab51f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/caddyhttp/reverseproxy/healthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ func (a *ActiveHealthChecks) Provision(ctx caddy.Context, h *Handler) error {
Transport: h.Transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if !a.FollowRedirects {
return fmt.Errorf(
"active health check encountered a redirect; enable 'health_follow_redirects' if redirects are intentional")
return http.ErrUseLastResponse

Check failure on line 161 in modules/caddyhttp/reverseproxy/healthchecks.go

View workflow job for this annotation

GitHub Actions / lint (mac)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/caddyserver/caddy/v2/cmd) -s prefix(github.com/caddyserver/caddy) --custom-order (gci)
}
return nil
},
Expand Down Expand Up @@ -463,7 +462,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, upstre
markUnhealthy()
return nil
}
} else if resp.StatusCode < 200 || resp.StatusCode >= 400 {
} else if resp.StatusCode < 200 || resp.StatusCode >= 300 {
h.HealthChecks.Active.logger.Info("status code out of tolerances",
zap.Int("status_code", resp.StatusCode),
zap.String("host", hostAddr),
Expand Down

0 comments on commit 5ab51f2

Please sign in to comment.