AutoHTTPS - сайты

Исправил ошибка, когда был поддомен - не срабатывал автоматический AUTOhttps
This commit is contained in:
2026-01-14 11:16:56 +07:00
parent a6007a8906
commit e1cb580899

View File

@@ -103,12 +103,27 @@ func Cert_start() {
} }
func checkHostCert(r *http.Request) bool { func checkHostCert(r *http.Request) bool {
host := r.Host
if _, err := os.Stat(certDir + r.Host); err != nil { // Убираем порт если есть
return false if colonIndex := strings.Index(host, ":"); colonIndex != -1 {
host = host[:colonIndex]
} }
return true // Проверяем точное совпадение
if _, err := os.Stat(certDir + host); err == nil {
return true
}
// Проверяем родительский домен
parentDomain := getParentDomain(host)
if parentDomain != "" {
if _, err := os.Stat(certDir + parentDomain); err == nil {
return true
}
}
return false
} }
func loadCertificates(certDir string) map[string]*tls.Certificate { func loadCertificates(certDir string) map[string]*tls.Certificate {