diff options
author | Francis Lavoie <[email protected]> | 2022-05-06 12:25:31 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-06 10:25:31 -0600 |
commit | f7be0ee10131f25620a2f64af7e3ded43eae2049 (patch) | |
tree | 986ae3462343180b3ab881ad9b3296e00e05e356 /modules/caddyhttp/map | |
parent | f6900fcf530e80c921dac8e4f09996cffce7f436 (diff) | |
download | caddy-f7be0ee10131f25620a2f64af7e3ded43eae2049.tar.gz caddy-f7be0ee10131f25620a2f64af7e3ded43eae2049.zip |
map: Prevent output destinations overlap with Caddyfile shorthands (#4657)v2.5.1
Diffstat (limited to 'modules/caddyhttp/map')
-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 8394b2114..f1ee46802 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) { |