Skip to content

[BUG] NO_PROXY completely ignored — Claude Code v2.1.83 routes all traffic through forward proxy regardless #39862

@wignerStan

Description

@wignerStan

Preflight Checklist

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

  1. curl correctly respects NO_PROXY with the same environment — only Claude Code is affected
  2. Setting proxy vars to empty string in settings.json env also does not work (the shell env vars still take priority)
  3. The only workaround is to unset proxy vars entirely before launching: HTTP_PROXY="" HTTPS_PROXY="" ALL_PROXY="" claude
  4. NO_PROXY="*" has no effect — documented to bypass all, but is ignored
  5. 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
  6. The 502 errors come from the forward proxy — the target API server's logs show zero incoming requests during failed tests

Steps to Reproduce

  1. Have a forward proxy running (e.g., export HTTP_PROXY=http://proxy:8080)
  2. Have a local API endpoint that works via curl (bypasses proxy via NO_PROXY)
  3. Configure ANTHROPIC_BASE_URL to point to the local endpoint
  4. Set NO_PROXY to include the local endpoint's IP
  5. Run claude -p "hello" — observe 502 errors
  6. Run HTTP_PROXY="" HTTPS_PROXY="" claude -p "hello" — observe success

Claude Code Version

2.1.83

Platform

Linux (native binary)

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions