[BUG] NO_PROXY completely ignored — Claude Code v2.1.83 routes all traffic through forward proxy regardless
Preflight Checklist
- [x] I have searched existing issues and found related but stale issues (#22004, #22752)
- [x] This is a single bug report
- [x] I am using the latest version (2.1.83)
What's Wrong?
Claude Code v2.1.83 completely ignores NO_PROXY. When proxy environment variables are set (HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY), Claude Code routes all API requests through the forward proxy, even when the target is listed in NO_PROXY. This causes 502 errors when the forward proxy cannot properly handle the streaming API connection.
This is a regression — issue #22004 was reportedly fixed in 2.1.38 but the bug has returned in 2.1.83.
What Should Happen?
Claude Code should respect NO_PROXY and bypass the forward proxy for destinations listed in it, matching the documented behavior:
Bypass proxy for specific requests - space-separated format export NO_PROXY="localhost 192.168.1.1 example.com .example.com"
Verified Test Matrix
Tested with claude -p "say ok" --model <model> against a local API proxy:
| Test | Proxy Env Set | NO_PROXY Value | Result |
|------|---------------|----------------|--------|
| 1 | None | None | EXIT 0 (works) |
| 2 | ALL_PROXY=socks5://... | — | 502 (fails) |
| 3 | HTTP_PROXY, HTTPS_PROXY | — | 502 (fails) |
| 4 | All proxies | * | 502 (fails) |
| 5 | HTTP_PROXY, HTTPS_PROXY | localhost 127.0.0.1 <target-ip> | 502 (fails) |
| 6 | ALL_PROXY=socks5://... | localhost 127.0.0.1 <target-ip> | 502 (fails) |
Additional Observations
curlcorrectly respectsNO_PROXYwith the same environment — only Claude Code is affected- Setting proxy vars to empty string in settings.json env also does not work (the shell env vars still take priority)
- The only workaround is to unset proxy vars entirely before launching:
HTTP_PROXY="" HTTPS_PROXY="" ALL_PROXY="" claude NO_PROXY="*"has no effect — documented to bypass all, but is ignored- SOCKS proxy (
ALL_PROXY=socks5://...) is not supported per docs, but Claude Code still attempts to use it instead of falling back to direct connection - The 502 errors come from the forward proxy — the target API server's logs show zero incoming requests during failed tests
Steps to Reproduce
- Have a forward proxy running (e.g.,
export HTTP_PROXY=http://proxy:8080) - Have a local API endpoint that works via
curl(bypasses proxy viaNO_PROXY) - Configure
ANTHROPIC_BASE_URLto point to the local endpoint - Set
NO_PROXYto include the local endpoint's IP - Run
claude -p "hello"— observe 502 errors - Run
HTTP_PROXY="" HTTPS_PROXY="" claude -p "hello"— observe success
Claude Code Version
2.1.83
Platform
Linux (native binary)
Related Issues
- #22004 — marked stale, reportedly fixed in 2.1.38 but regressed
- #22752 — duplicate of #22004
- #33642 — OAuth token refresh breaks with forward proxy (related)
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗