feat: Add more logging to CNAME resolution

This commit is contained in:
PapaTutuWawa 2024-01-06 19:52:12 +01:00
parent f4d8b151ec
commit cb40a0689b

View File

@ -73,9 +73,9 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
// Note: We do not check err here because err != nil
// always implies that cname == "", which does not have
// pagesDomain as a suffix.
cname, _ = dns.LookupCNAME(info.ServerName)
cname, err := dns.LookupCNAME(info.ServerName)
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
}
}