aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/reverseproxy/caddyfile.go
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2021-12-17 10:53:11 -0500
committerGitHub <[email protected]>2021-12-17 08:53:11 -0700
commit5333c3528bd2badf1676efcced322d151e3706c8 (patch)
tree3d8b62c94c524acc193af21ee7dd91f5ba99e645 /modules/caddyhttp/reverseproxy/caddyfile.go
parent180ae0cc4843ecc3c7ddcb6e978ebfd474ed07f9 (diff)
downloadcaddy-5333c3528bd2badf1676efcced322d151e3706c8.tar.gz
caddy-5333c3528bd2badf1676efcced322d151e3706c8.zip
reverseproxy: Fix incorrect `health_headers` Caddyfile parsing (#4485)
Fixes #4481
Diffstat (limited to 'modules/caddyhttp/reverseproxy/caddyfile.go')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go
index c37efd077..52282f7bc 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)