Upstream HTTP 502 - CC Switch (Claude Code / Codex)
Quick fix
Check your local network proxy (Clash/ZeroTier) config and make sure it does not interfere with direct requests.
Symptom
Section titled “Symptom”[FWD-003] Provider s-gpt-20x-local 请求失败: 上游 HTTP 502[FWD-003] Provider s-gpt-20x-local request failed: upstream HTTP 502
When CC Switch tries to forward a request directly to an upstream service on the LAN (Sub2API, for instance) and the upstream returns HTTP 502, the cause is usually not a defect in CC Switch itself but an intermediate network device or proxy program intercepting the traffic.
In the resolved cases, the problem came from the configuration of a local network management tool (Clash or ZeroTier, for example). Handling particular ports, IPs, or protocols (an SSE streaming response, say), those tools can hit compatibility problems that reset the connection or return a gateway error. Notably, relaying through an extra local Python forwarding proxy can make the request work again, which further points at network-layer interference on the original path rather than an application-layer logic error.
Check and adjust the bypass rules or configuration of your local network proxy software (Clash, ZeroTier, V2Ray, and so on) so it does not wrongly intercept or modify traffic to the upstream service IP and port.
Restart the network proxy software or reload its configuration, then retry the request in CC Switch.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why does it succeed when forwarded through a local Python proxy?
- Because the extra proxy may change HTTP headers (Connection, Accept-Encoding) or buffer the response, sidestepping the way the underlying network proxy software mishandles the original direct traffic.
- Is this a CC Switch bug?
- In the known cases, no — it is a compatibility problem between the local network environment (Clash/ZeroTier) and the upstream service. CC Switch acts only as a transparent forwarder in this scenario.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.