DEV Community

Mike
Mike

Posted on

Claude works in the browser but Claude Code can't connect: a 7-step proxy checklist

If claude.ai loads in your browser but Claude Code times out in the terminal, the browser is using your system proxy and the CLI is not. Claude Code is a terminal process and only reads proxy environment variables. In almost every case the cause is one of three things. The variable is not set in the shell that launched it, the address is a SOCKS address, or NO_PROXY is excluding the request.

Each step below gives you an answer in under a minute. Facts come from the official Claude Code network configuration page, checked on 15 November 2026.

1. Find your local HTTP port

Open the settings of Clash Verge Rev, FlClash or whatever client you run and look for the HTTP port or mixed port. 7890 and 7897 are common. Use the number your own client shows.

A subscription URL is not a proxy address. Neither is the remote port of a node. You need the port your client listens on locally.

2. Set the variables in the same shell, then launch

zsh or bash on macOS and Linux

export HTTPS_PROXY="http://127.0.0.1:7890"
export HTTP_PROXY="$HTTPS_PROXY"
claude
Enter fullscreen mode Exit fullscreen mode

PowerShell on Windows has no export command

$env:HTTPS_PROXY = "http://127.0.0.1:7890"
$env:HTTP_PROXY = $env:HTTPS_PROXY
claude
Enter fullscreen mode Exit fullscreen mode

Claude Code reads these variables once at startup. Quit the running session and start it again after any change.

3. Do not use a SOCKS address

The docs state that Claude Code does not support SOCKS proxies. An address starting with socks5:// will not work. Use the HTTP or mixed port with an http:// prefix.

The name HTTPS_PROXY describes the kind of request being proxied. The local proxy address itself still starts with http://.

4. Look for an older variable that wins

Claude Code uses the first one that is set, in this order

  1. https_proxy
  2. HTTPS_PROXY
  3. http_proxy
  4. HTTP_PROXY

A lowercase https_proxy left in your .zshrc years ago will override the uppercase one you just exported.

env | grep -i proxy
Enter fullscreen mode Exit fullscreen mode

5. Check NO_PROXY

echo $NO_PROXY $no_proxy
Enter fullscreen mode Exit fullscreen mode

If it contains anthropic.com, claude.ai or a bare asterisk, those requests skip the proxy. Entries can be separated by spaces or commas, and an asterisk bypasses everything. On a work laptop, remove only the entry that is in the way.

6. Ask Claude Code what it is using

Run /status inside a session and read the Proxy row. It shows the active proxy URL and marks a value it cannot parse as invalid.

If the address is missing its http:// scheme, Claude Code stops at launch with an error that names the variable.

For more detail, start with debug logging

claude --debug
Enter fullscreen mode Exit fullscreen mode

The log goes to ~/.claude/debug/ and is not printed in the terminal.

7. Test the proxy without Claude Code

curl -x http://127.0.0.1:7890 -I https://api.anthropic.com
Enter fullscreen mode Exit fullscreen mode

If response headers come back, the path from your terminal through the proxy works and the problem is in the variables. If it times out or the connection is refused, the problem is the client or the node, so go back to step 1.

Two cases people miss

WSL, containers and remote servers. Inside these, 127.0.0.1 is the environment itself, not the client on your Windows or Mac host. Use an address the environment can reach and enable LAN access in the client.

Making it permanent, and background agents. Put the variables in the env block of ~/.claude/settings.json. The docs point out that background agents do not inherit the shell you are typing in, so settings are the only place that reaches them reliably.

{
  "env": {
    "HTTPS_PROXY": "http://127.0.0.1:7890",
    "HTTP_PROXY": "http://127.0.0.1:7890"
  }
}
Enter fullscreen mode Exit fullscreen mode

Domains that must go through the proxy in rule mode

  • api.anthropic.com
  • claude.ai
  • claude.com
  • platform.claude.com

Miss one and sign-in hangs.

What a proxy will not fix

  • A 401, 403 or 429 means the request reached Anthropic. That is authentication, permissions or rate limiting, so read the response body.
  • A disabled account can only be restored through the official appeal.
  • Anthropic decides availability by where you actually are. Changing your exit does not change that rule, so check the supported countries list first.

References

Disclosure. I work on NailongVPN (nailongvpn.com) and wrote this while helping users debug. A longer version covering Cursor, GitHub Copilot and API errors is at https://nailongvpn.com/en/ai-connectivity

Top comments (0)