Skip to content

Commit

Permalink
wip: return error on redirect in active health check
Browse files Browse the repository at this point in the history
  • Loading branch information
aliasgar committed May 3, 2024
1 parent 7e2510e commit 486a204
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/caddyhttp/reverseproxy/healthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"runtime/debug"
"strconv"
"time"
"errors"

"go.uber.org/zap"

Expand Down Expand Up @@ -153,6 +154,9 @@ 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 {
return errors.New("Cannot redirect")
},
}

for _, upstream := range h.Upstreams {
Expand Down

0 comments on commit 486a204

Please sign in to comment.