IP Judge ipjudge.org

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.

At a glance: browser vs terminalIn system-proxy mode the browser reads the proxy from system settings, so claude.ai goes through the proxy exit. Claude Code runs in a terminal and ignores the system proxy; with no proxy variables set, it connects directly from your own network. At a glance: browser vs terminal claude.ai in the browser Proxied Browser Proxy app Proxy exit Browsers pick up the system proxy setting Claude Code in a terminal Direct Claude Code Skips proxy Direct exit It reads only https_proxy and similar variables Set the proxy variables, or use TUN mode, to route it.
A working browser doesn’t mean the terminal is proxied: Claude Code only looks at the terminal’s proxy variables and goes direct without them.

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_PROXY set, curl uses the proxy and Claude Code doesn’t — so testing with curl looks fine when it isn’t.
Which proxy settings Claude Code readsClaude Code checks https_proxy, HTTPS_PROXY, http_proxy and HTTP_PROXY in that order and uses the first one set, once at startup. SOCKS proxies, ALL_PROXY and the system proxy don’t work for it. Background sessions only read the env block in ~/.claude/settings.json. Which proxy settings Claude Code reads Checked in order; first set wins Read 1https_proxy 2HTTPS_PROXY 3http_proxy 4HTTP_PROXY Read once at startup: open a new terminal Ignored by Claude Code Not read socks5://…No SOCKS support ALL_PROXYcurl uses it, Claude Code doesn’t System proxyTerminal programs don’t read it Background sessions only read env in ~/.claude/settings.json Use your proxy app’s HTTP / mixed port, e.g. 7890.
With only ALL_PROXY set, curl uses the proxy and Claude Code doesn’t, so a curl test 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