From 5333c3528bd2badf1676efcced322d151e3706c8 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Fri, 17 Dec 2021 10:53:11 -0500 Subject: reverseproxy: Fix incorrect `health_headers` Caddyfile parsing (#4485) Fixes #4481 --- modules/caddyhttp/reverseproxy/caddyfile.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'modules/caddyhttp') diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index c37efd0..52282f7 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -361,15 +361,13 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { case "health_headers": healthHeaders := make(http.Header) - for d.Next() { - for d.NextBlock(0) { - key := d.Val() - values := d.RemainingArgs() - if len(values) == 0 { - values = append(values, "") - } - healthHeaders[key] = values + for nesting := d.Nesting(); d.NextBlock(nesting); { + key := d.Val() + values := d.RemainingArgs() + if len(values) == 0 { + values = append(values, "") } + healthHeaders[key] = values } if h.HealthChecks == nil { h.HealthChecks = new(HealthChecks) -- cgit v1.2.3