summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-08-31 13:22:34 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-08-31 13:22:34 -0600
commit724b74d98144e502d4cd7b2a4b1c2309e7536d4f (patch)
tree02512ac7fb756e7b7cf6a68bda89b01dbb8ec3a8
parent494032584436338896cd275d7563bc7b325cd1c4 (diff)
reverseproxy: Abort active health checks on context cancellation
-rw-r--r--modules/caddyhttp/reverseproxy/healthchecks.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go
index 79f18fc..33cfd82 100644
--- a/modules/caddyhttp/reverseproxy/healthchecks.go
+++ b/modules/caddyhttp/reverseproxy/healthchecks.go
@@ -216,9 +216,8 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, host H
u.Host = net.JoinHostPort(host, portStr)
}
- // attach dialing information to this request - TODO: use caddy.Context's context
- // so it can be canceled on config reload
- ctx := context.Background()
+ // attach dialing information to this request
+ ctx := h.ctx.Context
ctx = context.WithValue(ctx, caddy.ReplacerCtxKey, caddy.NewReplacer())
ctx = context.WithValue(ctx, caddyhttp.VarsCtxKey, map[string]interface{}{
dialInfoVarKey: dialInfo,