mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-28 15:32:13 +00:00
fix(gateway): prevent Cloudflare 1010 from disabling OpenCode and Command Code accounts
This commit is contained in:
1 parent
1c0a69c0ce
commit
fa79b1ebc3
10 files changed
+297
No files matched your search
@@ -1510,6 +1510,10 @@ func (s *OpenAIGatewayService) buildUpstreamRequest(ctx context.Context, c *gin.
|
||||
req.Header.Set("content-type", "application/json")
|
||||
}
|
||||
|
||||
// 官方 OpenCode / Command Code 上游收敛为规范客户端 UA:客户端透传的编程库
|
||||
// UA 会命中其前置 Cloudflare bot 拦截(CF 1010/403),并被计入账号 403 strike。
|
||||
applyOpenCodeUpstreamUserAgent(account, targetURL, req.Header)
|
||||
|
||||
// 账号级请求头覆写(仅 openai api_key 账号启用时生效;OAuth 路径 no-op)
|
||||
account.ApplyHeaderOverrides(req.Header)
|
||||
applyOpenCodeSessionHeader(c, account, targetURL, req.Header, body, openCodeSessionHintBody(promptCacheKey))
|
||||
|
||||
Reference in new issue
Block a user