diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-08-31 13:22:34 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-08-31 13:22:34 -0600 |
commit | 724b74d98144e502d4cd7b2a4b1c2309e7536d4f (patch) | |
tree | 02512ac7fb756e7b7cf6a68bda89b01dbb8ec3a8 /modules/caddyhttp | |
parent | 494032584436338896cd275d7563bc7b325cd1c4 (diff) |
reverseproxy: Abort active health checks on context cancellation
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/reverseproxy/healthchecks.go | 5 |
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, |