I would like to ask whether Caddy server's reverseproxy dynamic upstream supports passive health checks. · Issue #7037 · caddyserver/caddy · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (h *Handler) proxyLoopIteration(r *http.Request, origReq *http.Request, w http.ResponseWriter, proxyErr error, start time.Time, retries int,
repl *caddy.Replacer, reqHeader http.Header, reqHost string, next caddyhttp.Handler,
) (bool, error) {
// get the updated list of upstreams
upstreams := h.Upstreams
if h.DynamicUpstreams != nil {
dUpstreams, err := h.DynamicUpstreams.GetUpstreams(r)
if err != nil {
h.logger.Error("failed getting dynamic upstreams; falling back to static upstreams", zap.Error(err))
} else {
upstreams = dUpstreams
for _, dUp := range dUpstreams {
h.provisionUpstream(dUp)
}
h.logger.Debug("provisioned dynamic upstreams", zap.Int("count", len(dUpstreams)))
defer func() {
// these upstreams are dynamic, so they are only used for this iteration
// of the proxy loop; be sure to let them go away when we're done with them
for _, upstream := range dUpstreams {
_, _ = hosts.Delete(upstream.String())
}
}()
}
}
The main issue lies in the defer method, which deletes the hosts. If the deletion didn't happen, it would work. However, I am not sure what the impact would be if the deletion were omitted.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Based on my own testing, reverseproxy dynamic upstream does not support passive health checks. This conclusion is drawn from the following code:
github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy/reverseproxy.go:461
The main issue lies in the defer method, which deletes the hosts. If the deletion didn't happen, it would work. However, I am not sure what the impact would be if the deletion were omitted.
The text was updated successfully, but these errors were encountered: