fix(proxy): log error when upstream TLS config creation fails

Previously the error was silently swallowed, causing the proxy to
fall back to default TLS settings (no custom CA, no mTLS, no SNI)
without any indication. Now the error is logged at ERROR level.
This commit is contained in:
xfy 2026-06-03 01:09:40 +08:00
parent 2c3cc1ba38
commit f6c1ee8180

View File

@ -337,7 +337,9 @@ func createHostClient(targetURL string, timeout config.ProxyTimeout, transportCf
// 上游 SSL 配置(使用原生 TLSConfig
if sslCfg != nil && sslCfg.Enabled && isTLS {
tlsCfg, err := CreateTLSConfig(sslCfg, extractHostFromURL(targetURL))
if err == nil {
if err != nil {
logging.Error().Err(err).Str("target", targetURL).Msg("Failed to create upstream TLS config")
} else {
client.TLSConfig = tlsCfg
}
}