summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/map
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-05-06 12:25:31 -0400
committerGitHub <noreply@github.com>2022-05-06 10:25:31 -0600
commitf7be0ee10131f25620a2f64af7e3ded43eae2049 (patch)
tree986ae3462343180b3ab881ad9b3296e00e05e356 /modules/caddyhttp/map
parentf6900fcf530e80c921dac8e4f09996cffce7f436 (diff)
map: Prevent output destinations overlap with Caddyfile shorthands (#4657)
Diffstat (limited to 'modules/caddyhttp/map')
-rw-r--r--modules/caddyhttp/map/caddyfile.go5
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) {