From 724b74d98144e502d4cd7b2a4b1c2309e7536d4f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 31 Aug 2020 13:22:34 -0600 Subject: reverseproxy: Abort active health checks on context cancellation --- modules/caddyhttp/reverseproxy/healthchecks.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules') 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, -- cgit v1.2.3