diff options
author | Francis Lavoie <lavofr@gmail.com> | 2022-05-06 12:25:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 10:25:31 -0600 |
commit | f7be0ee10131f25620a2f64af7e3ded43eae2049 (patch) | |
tree | 986ae3462343180b3ab881ad9b3296e00e05e356 /modules | |
parent | f6900fcf530e80c921dac8e4f09996cffce7f436 (diff) |
map: Prevent output destinations overlap with Caddyfile shorthands (#4657)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/map/caddyfile.go | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |