httpcaddyfile: Add default_bind global option (#4531)

This commit is contained in:
Francis Lavoie 2022-01-18 13:29:07 -05:00 committed by GitHub
parent 93a7a45e7e
commit 1b7ff5d76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 1 deletions

View file

@ -213,7 +213,11 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str
lnHosts = append(lnHosts, cfgVal.Value.([]string)...)
}
if len(lnHosts) == 0 {
lnHosts = []string{""}
if defaultBind, ok := options["default_bind"].(string); ok {
lnHosts = []string{defaultBind}
} else {
lnHosts = []string{""}
}
}
// use a map to prevent duplication