Guides ·
Claude Code proxy settings: why the browser works but the terminal goes direct
A common situation: claude.ai works fine in the browser, but Claude Code can’t connect, says your region isn’t supported, or the account gets verification prompts. Usually the line isn’t the problem — the terminal isn’t using the proxy at all.
Why the terminal differs from the browser
Many proxy apps default to “system proxy” mode: the address goes into system settings, which browsers read and terminal programs don’t. Per Claude Code’s documentation, it reads only these variables, taking the first one set, in this order:
https_proxy → HTTPS_PROXY → http_proxy → HTTP_PROXY
- No SOCKS support:
https_proxy=socks5://…doesn’t work for Claude Code. - ALL_PROXY is ignored: with only
ALL_PROXYset, curl uses the proxy and Claude Code doesn’t — so testing with curl looks fine when it isn’t.
How to set it
Add this to ~/.zshrc (or ~/.bashrc), using your proxy app’s HTTP / mixed port (often 7890 or 7897):
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890
Open a new terminal before starting Claude Code; variables are read once at startup. You can also put them in the env block of ~/.claude/settings.json — background Claude Code sessions don’t inherit your shell and only read that. Alternatively, switch the proxy app to TUN / enhanced mode so it captures all traffic.
How to verify
curl -sL ipjudge.org/en/cc | bash
Run it in the same terminal as Claude Code. It works out the proxy Claude Code actually uses by Claude Code’s own rules, asks api.anthropic.com which IP it sees, and compares claude.ai, api.openai.com, chatgpt.com and the no-proxy exit. Read-only. Inside Claude Code, /status shows the active proxy on its “Proxy” row.
Once the exit is right
- The region must be on Anthropic’s list — mainland China, Hong Kong and Macau aren’t.
- Keep the browser and terminal on the same exit, and claude.ai, api.anthropic.com and platform.claude.com on the same line. The Claude check compares them.
- Datacenter IPs work but get verification prompts more often.
Which kind of IP do you have?
Check my IP for free