From f7be0ee10131f25620a2f64af7e3ded43eae2049 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Fri, 6 May 2022 12:25:31 -0400 Subject: map: Prevent output destinations overlap with Caddyfile shorthands (#4657) --- modules/caddyhttp/map/caddyfile.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/caddyhttp/map') diff --git a/modules/caddyhttp/map/caddyfile.go b/modules/caddyhttp/map/caddyfile.go index 8394b21..f1ee468 100644 --- a/modules/caddyhttp/map/caddyfile.go +++ b/modules/caddyhttp/map/caddyfile.go @@ -56,6 +56,11 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) if len(handler.Destinations) == 0 { return nil, h.Err("missing destination argument(s)") } + for _, dest := range handler.Destinations { + if shorthand := httpcaddyfile.WasReplacedPlaceholderShorthand(dest); shorthand != "" { + return nil, h.Errf("destination %s conflicts with a Caddyfile placeholder shorthand", shorthand) + } + } // mappings for h.NextBlock(0) { -- cgit v1.2.3