fix: 修复 TLS ConnectionState、SPA 回退、健康检查与监听小问题

This commit is contained in:
Nixevol
2026-09-30 15:08:45 +08:00
parent 67a33ba9e5
commit 9e3769f740
17 changed files with 598 additions and 62 deletions
+10 -1
View File
@@ -1,6 +1,7 @@
package main
import (
"crypto/tls"
"fmt"
"io"
"net"
@@ -25,8 +26,16 @@ func cmdHealthcheck(_ []string) error {
if err != nil {
return err
}
url := "http://" + addr + "/healthz"
scheme := "http"
client := &http.Client{Timeout: 3 * time.Second}
if strings.TrimSpace(cfg.TLS.CertFile) != "" && !cfg.TLS.AllowPlaintext {
scheme = "https"
// 只连 127.0.0.1 做存活探测,不涉及证书身份校验。
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec
}
}
url := scheme + "://" + addr + "/healthz"
resp, err := client.Get(url)
if err != nil {
return fmt.Errorf("healthcheck %s: %w", url, err)