mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-24 01:26:47 +01:00
letsencrypt: Remote duplicate hosts from certificate request
Domain names must be unique in cert bundle request or really bad things happen (like, um, a panic)
This commit is contained in:
parent
19c6bbf6a2
commit
9002db2ae0
1 changed files with 13 additions and 3 deletions
|
@ -79,9 +79,19 @@ func Activate(configs []server.Config) ([]server.Config, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// little bit of housekeeping; gather the hostnames into a slice
|
// little bit of housekeeping; gather the hostnames into a slice
|
||||||
hosts := make([]string, len(cfgIndexes))
|
var hosts []string
|
||||||
for i, idx := range cfgIndexes {
|
for _, idx := range cfgIndexes {
|
||||||
hosts[i] = configs[idx].Host
|
// don't allow duplicates (happens when serving same host on multiple ports!)
|
||||||
|
var duplicate bool
|
||||||
|
for _, otherHost := range hosts {
|
||||||
|
if configs[idx].Host == otherHost {
|
||||||
|
duplicate = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !duplicate {
|
||||||
|
hosts = append(hosts, configs[idx].Host)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// client is ready, so let's get free, trusted SSL certificates!
|
// client is ready, so let's get free, trusted SSL certificates!
|
||||||
|
|
Loading…
Reference in a new issue