Compare commits
2 Commits
f4d8b151ec
...
be42e60731
Author | SHA1 | Date | |
---|---|---|---|
be42e60731 | |||
cb40a0689b |
@ -1,7 +1,6 @@
|
|||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -59,10 +58,6 @@ func LookupRepoTXT(domain string) (string, error) {
|
|||||||
func LookupCNAME(domain string) (string, error) {
|
func LookupCNAME(domain string) (string, error) {
|
||||||
cname, found := cnameCache.Get(domain)
|
cname, found := cnameCache.Get(domain)
|
||||||
if found {
|
if found {
|
||||||
if cname == "" {
|
|
||||||
return "", errors.New("Previous request failure")
|
|
||||||
}
|
|
||||||
|
|
||||||
return cname.(string), nil
|
return cname.(string), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +67,5 @@ func LookupCNAME(domain string) (string, error) {
|
|||||||
return cname.(string), nil
|
return cname.(string), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
cnameCache.Set(domain, "", cache.DefaultExpiration)
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,9 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
|
|||||||
// Note: We do not check err here because err != nil
|
// Note: We do not check err here because err != nil
|
||||||
// always implies that cname == "", which does not have
|
// always implies that cname == "", which does not have
|
||||||
// pagesDomain as a suffix.
|
// pagesDomain as a suffix.
|
||||||
cname, _ = dns.LookupCNAME(info.ServerName)
|
cname, err := dns.LookupCNAME(info.ServerName)
|
||||||
if !strings.HasSuffix(cname, pagesDomain) {
|
if !strings.HasSuffix(cname, pagesDomain) {
|
||||||
log.Warnf("Got ServerName for Domain %s that we're not responsible for", info.ServerName)
|
log.Warnf("Got ServerName for Domain %s that we're not responsible for. CNAME '%s', err: %v", info.ServerName, cname, err)
|
||||||
return cache.FallbackCertificate.TlsCertificate, nil
|
return cache.FallbackCertificate.TlsCertificate, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user