diff --git a/backend/internal/repository/http_upstream_antigravity.go b/backend/internal/repository/http_upstream_antigravity.go index 0d0e0550..2501b4a8 100644 --- a/backend/internal/repository/http_upstream_antigravity.go +++ b/backend/internal/repository/http_upstream_antigravity.go @@ -23,17 +23,17 @@ import ( ) // isTLSFingerprintRoutingEnabled 检查 TLS 指纹路由是否启用 -// 复用 NodeTLSProxy.Enabled 配置项,保持配置兼容 +// 使用 TLSFingerprint.Enabled 配置项(而不是旧的 NodeTLSProxy.Enabled) func (s *httpUpstreamService) isTLSFingerprintRoutingEnabled() bool { if s.cfg == nil { return false } - return s.cfg.Gateway.NodeTLSProxy.Enabled + return s.cfg.Gateway.TLSFingerprint.Enabled } // shouldRouteWithTLSFingerprint 判断请求是否应该使用 TLS 指纹 -// 仅拦截目标主机在 proxy_hosts 白名单中的 HTTPS 请求, -// 白名单为空时默认只代理 api.anthropic.com。 +// 拦截目标主机在 proxy_hosts 白名单中的 HTTPS 请求 +// 白名单为空时默认代理 api.anthropic.com 和 Antigravity API 主机 func (s *httpUpstreamService) shouldRouteWithTLSFingerprint(req *http.Request) bool { if req == nil || req.URL == nil || req.URL.Scheme != "https" { return false @@ -45,7 +45,13 @@ func (s *httpUpstreamService) shouldRouteWithTLSFingerprint(req *http.Request) b hosts := s.cfg.Gateway.NodeTLSProxy.ProxyHosts if len(hosts) == 0 { - return reqHost == "api.anthropic.com" + // 默认白名单:api.anthropic.com 和 Antigravity API 主机 + defaultHosts := map[string]bool{ + "api.anthropic.com": true, + "cloudcode-pa.googleapis.com": true, + "daily-cloudcode-pa.sandbox.googleapis.com": true, + } + return defaultHosts[reqHost] } for _, h := range hosts { if reqHost == h {