summaryrefslogtreecommitdiff
path: root/caddyconfig/caddyfile
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-08-23 13:26:07 -0400
committerGitHub <noreply@github.com>2021-08-23 11:26:07 -0600
commitd74913f871414ddac9a3884fc6aef4492ee4f65f (patch)
tree8f10e0c34e2fa38260b655ca9b9180b559eee5d4 /caddyconfig/caddyfile
parentce5a45db458166ff71cb776d70fd63e28196aafa (diff)
caddyfile: Error on invalid site addresses containing comma (#4302)
Some users forget to use a comma between their site addresses. This is invalid (commas aren't a valid character in domains) and later parts of the code like certificate automation will try to use this otherwise, which doesn't make sense. Best to error as early as possible. Example thread on the forums where this happened: https://caddy.community/t/simplify-caddyfile/13281/9
Diffstat (limited to 'caddyconfig/caddyfile')
-rwxr-xr-xcaddyconfig/caddyfile/parse.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/caddyconfig/caddyfile/parse.go b/caddyconfig/caddyfile/parse.go
index d870765..5906bdd 100755
--- a/caddyconfig/caddyfile/parse.go
+++ b/caddyconfig/caddyfile/parse.go
@@ -229,6 +229,13 @@ func (p *parser) addresses() error {
expectingAnother = false // but we may still see another one on this line
}
+ // If there's a comma here, it's probably because they didn't use a space
+ // between their two domains, e.g. "foo.com,bar.com", which would not be
+ // parsed as two separate site addresses.
+ if strings.Contains(tkn, ",") {
+ return p.Errf("Site addresses cannot contain a comma ',': '%s' - put a space after the comma to separate site addresses", tkn)
+ }
+
p.block.Keys = append(p.block.Keys, tkn)
}