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.
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.
zsh or bash on macOS and Linux
export HTTPS_PROXY="http://127.0.0.1:7890"
export HTTP_PROXY="$HTTPS_PROXY"
claude
PowerShell on Windows has no export command
$env:HTTPS_PROXY = "http://127.0.0.1:7890"
$env:HTTP_PROXY = $env:HTTPS_PROXY
claude
Claude Code reads these variables once at startup. Quit the running session and start it again after any change.
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://.
Claude Code uses the first one that is set, in this order
A lowercase https_proxy left in your .zshrc years ago will override the uppercase one you just exported.
env | grep -i proxy
echo $NO_PROXY $no_proxy
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.
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
The log goes to ~/.claude/debug/ and is not printed in the terminal.
curl -x http://127.0.0.1:7890 -I https://api.anthropic.com
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.
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"
}
}
Miss one and sign-in hangs.
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