# Claude Code Won't Connect? Claude Code Proxy Settings, Verified Point by Point

> Just because your browser can open Claude doesn't mean Claude Code is going through the proxy. This article walks the whole Claude Code proxy setup end to end — from what your egress type looks like to the platform, to wiring up the proxy chain, to checking each item off — and includes a troubleshooting table.

- Source: https://ipnet.coffee/en/news/claude-code-proxy-setup-guide
- Published: 2026-11-19
- Updated: 2026-11-25
- Publisher: ipnet.coffee

Claude Code network problems have one distinguishing feature: **everything looks fine on the browser side, while the terminal side is what's broken**. The browser opens claude.ai, the test page shows a clean overseas IP, and yet Claude Code still fails to log in, keeps asking for verification, or drops out halfway through.

That's because the browser and the terminal are two independent network paths, and they read different proxy settings. This article breaks Claude Code proxy settings into three things: what egress to choose, how to wire up the chain, and how to prove it's actually working.

## 1. What should the egress be?

Claude Code isn't a series of independent requests — it's a long-lived session: you log in once, the token is saved, and every connection over the next few hours carries the same credentials. So the first principle is: **the egress must be static**.

But "static" is only the baseline. What really determines whether you keep getting asked to verify is **what that egress looks like to the platform**. Two fixed IPs can look like completely different things depending on whether they're residential or datacenter.

Use four questions to decide:

- Does the task finish in seconds and require no login? A rotating proxy is fine.
- Do you need to stay logged in for hours at a time? The egress must be fixed, no debate.
- Has the account always been used on a phone, or on a desktop and fixed broadband? That decides mobile IP versus residential IP.
- Are you just doing a short-term test on a disposable account? A datacenter IP is the cheapest fixed address and is acceptable.

The difference between the three kinds of fixed egress is "what it looks like to the other side":

| Egress type | What the platform sees | Best for |
|---|---|---|
| Static residential (ISP) IP | The address belongs to a carrier's home broadband range and doesn't change | The default choice for Claude Code |
| Static mobile IP | Belongs to a mobile carrier's range, looks most like an ordinary phone user | When the account's history has always been on mobile |
| Static datacenter IP | Belongs to a hosting provider's range — exactly the kind of signal that triggers extra verification | Testing; not suitable as a long-term main account |

Claude Code runs on a computer over fixed broadband, so a mobile IP isn't any more "consistent" than a residential one — it's just a different kind of inconsistency. Unless the account's history has always been on mobile, there's no need.

Once you have the address, **check it on its own before wiring it in**. Enter the IP in [IP deep scoring](https://ipnet.coffee/en/ip) and confirm the country, ASN (definition in [ARIN's ASN guide](https://www.arin.net/resources/guide/asn/)), and network type match what you bought, and that there are no blacklist records. If a newly purchased IP is already blacklisted, ask for a replacement rather than trying to make it work.

## 2. Claude Code Proxy Settings: the four-link chain, and what order to connect them in

A rule pointing at a proxy does nothing by itself. All four links below must be connected; break any one and the symptom is the same: traffic leaves from somewhere you didn't want.

**Link 1: node credentials.** Get the address, port, username and password from your provider, and confirm the protocol (HTTP / HTTPS / SOCKS5) is one your proxy client supports.

**Link 2: a dedicated outbound.** In your proxy client, create a separate node and group for Claude, with a name you'll recognize instantly in the logs, such as Claude. Use the select group type (manual selection), not url-test, fallback or load-balancing — those switch nodes automatically mid-session.

**Link 3: routing rules.** Point every Claude-related domain and IP range at this group, not at the default PROXY. If the rule says PROXY but the group is called Claude, the rule silently matches nothing. For the full domain list, see [the complete Claude Code routing rule list](https://ipnet.coffee/en/news/claude-code-proxy-domain-list).

**Link 4: the terminal.** This is the link most people miss. When a proxy client turns on "system proxy", it changes the operating system's proxy settings. Browsers read that; command-line tools like Claude Code don't — they read environment variables. In the same terminal you launch Claude Code from, set:

```bash
export HTTPS_PROXY="http://127.0.0.1:7890"
export HTTP_PROXY="$HTTPS_PROXY"
export NO_PROXY="localhost,127.0.0.1,::1"
```

Two things to note:

- Claude Code officially supports HTTP / HTTPS proxies and **does not support SOCKS proxies**. If your client only exposes a SOCKS port, turn on its HTTP port or mixed port (7890 for Clash-family clients).
- When you launch from an IDE such as VS Code or JetBrains, or from a GUI, the variables you set in .zshrc often aren't inherited.

A more reliable approach is to put the proxy in Claude Code's own config file, ~/.claude/settings.json, so it applies no matter where you launch from:

```json
{
  "env": {
    "HTTPS_PROXY": "http://127.0.0.1:7890",
    "HTTP_PROXY": "http://127.0.0.1:7890",
    "NO_PROXY": "localhost,127.0.0.1,::1"
  }
}
```

If you'd rather not deal with environment variables, you can switch the proxy client to TUN mode and take over every program at the network layer. For the difference between the two modes and where to set them in each client, see [Claude Code not using the proxy? System proxy vs. TUN mode](https://ipnet.coffee/en/news/claude-code-system-proxy-vs-tun).

## 3. Where are the three most likely break points?

**The terminal isn't going through the proxy at all.** The browser shows the proxy IP; the terminal shows your real IP. This is the most common single failure, and you can't see it unless you check.

**TCP goes through the proxy, DNS doesn't.** Routing rules decide where a connection leaves from; they don't decide who receives DNS queries. If the client resolves domains locally and only forwards connections, your ISP's DNS still knows what you're visiting and where you are. For the full DNS query path, see [Cloudflare's DNS explainer](https://www.cloudflare.com/learning/dns/what-is-dns/).

**IPv6 isn't covered by the rules.** If your network has IPv6 and your rules only cover IPv4, domains with AAAA records may go out directly over IPv6 without matching any rule. Either route IPv6 through the proxy too, or disable IPv6 on that machine.

## 4. How do you verify each item?

### Step 0: Do the terminal and the browser match?

In the same terminal you launch Claude Code from, run:

```bash
curl https://ipnet.coffee
```

It returns the egress IP, country, ASN and network type. Then open the [Claude check page](https://ipnet.coffee/en/claude) in your browser and compare. **If the two don't match, stop here** — everything after this would be testing the wrong path.

If the terminal returns an IPv6 address belonging to your local carrier, IPv6 isn't going through the proxy — that's exactly the third break point above.

You can also confirm whether Claude Code's API connections go through the local proxy:

```bash
curl -sv https://api.anthropic.com 2>&1 | grep -i "connected to"
```

If it shows 127.0.0.1 plus your proxy port, that connection is going into the proxy client; if it shows an address starting with 160.79, it's connecting to Anthropic directly.

### Step 1: How do you read the egress itself?

In [IP deep scoring](https://ipnet.coffee/en/ip), look at things in this order:

- **ASN and carrier**: whose network this is. If you bought a residential IP and the lookup shows a datacenter ASN, you didn't get what you paid for.
- **Network type**: residential or datacenter. Databases disagree most on this field, so look at it after the ASN.
- **Blacklist**: any record is a hard fail — replace it.

### Step 2: How do you read the environment?

The [Claude check page](https://ipnet.coffee/en/claude) gives results item by item. The ones that matter most for Claude Code are: network type (residential / datacenter), WebRTC leaks, DNS leaks, and whether the timezone matches the IP. Language and fingerprint-consistency items mainly affect browsers and matter little for terminal tools.

**Look at the individual results, not just the total score.** An environment with a clean IP type, no leaks and a total of 78 is far better than one that hides a datacenter IP behind a perfect fingerprint and scores 92.

Also, the "automation flag" item has nothing to do with the proxy. If it triggers when you aren't running any automation scripts, something on the machine — a debug port, a driver or an extension — is controlling the browser. Find it first.

### Step 3: How do you test DNS separately?

Run a **deep test** with [DNS leak test](https://ipnet.coffee/en/dns). There are three possible outcomes:

- **Same region**: the resolver and the egress are in the same country — ideal.
- **Public DNS**: the resolver is a public one such as Google or Cloudflare, and the node is in another country. Public DNS assigns nodes by proximity, so this generally isn't a leak.
- **Suspected leak**: your local carrier's resolver shows up, meaning DNS queries aren't going through the proxy.

How to fix it: enable TUN mode or your client's Fake-IP / DNS takeover; check whether your system or router has your carrier's DNS entered manually; if the browser has secure DNS enabled, make sure that goes through the proxy too. Restart the browser after the change and run the deep test again. For how to test DNS separately on the terminal side, see [how to check for Claude Code DNS leaks](https://ipnet.coffee/en/news/claude-code-dns-leak-test).

### Step 4: Why retest after every change?

One test only proves it was fine at that moment. After changing rules, switching client modes, or updating the client or subscription, run the same sequence again: terminal egress, IP scoring, environment check, DNS test. It takes a few minutes.

## Ten-point checklist

1. The egress IP returned by curl in the terminal matches the browser check page
2. The egress IP's ASN matches the type you bought (residential / mobile / datacenter)
3. The egress IP isn't on any DNSBL blacklist
4. The proxy group is type select, with a manually chosen node
5. The routing rules cover all of Claude's domains and IP ranges
6. Terminal environment variables or settings.json are configured, and take effect when launched from an IDE too
7. Connections to api.anthropic.com go through the local proxy port
8. The DNS deep test shows no local carrier resolver
9. WebRTC doesn't expose your internal or real address
10. Timezone and language match the egress region

## Troubleshooting table

| Symptom | Most likely cause | Check first |
|---|---|---|
| Browser fine, terminal login fails | Terminal isn't using the proxy | Egress IP from curl in the terminal |
| Frequent verification prompts after login | Egress changed mid-session | Whether the group is an auto-latency-test type |
| Long task stalls halfway | Connection drops mid-way | Whether the egress IP drifts, whether the line is dropping packets |
| Test shows a DNS leak | DNS isn't being captured | TUN mode, fake-ip, browser secure DNS |
| Test shows a WebRTC leak | UDP isn't going through the proxy | Whether the client captures UDP |
| Everything looks fine but verification is still requested | Egress type or account history | IP type, ASN, blacklist |

## FAQ

### The browser can open Claude, so why doesn't Claude Code work?

The browser and the terminal are two independent network paths that read different proxy settings. The browser reads the system proxy; command-line tools only honor environment variables. Test them separately.

### Why can't I use an auto-latency-test group?

Groups like url-test, fallback and load-balance switch nodes automatically when latency changes, and swapping egress mid-session takes an instant. Create a select-type group for Claude and pick a node manually.

### Does Claude Code support SOCKS proxies?

No. It officially supports HTTP / HTTPS proxies only. If your client only exposes a SOCKS port, turn on its HTTP port or mixed port (7890 for Clash-family clients).

### Why doesn't it work when I launch from an IDE?

When you launch from a GUI such as VS Code or JetBrains, the variables you set in .zshrc often aren't inherited. Putting the proxy in ~/.claude/settings.json is more reliable.

### The total score is high, so why am I still being asked to verify?

Look at the individual results, not just the total score. An environment with a clean IP type, no leaks and a total of 78 is far better than one that hides a datacenter IP behind a perfect fingerprint and scores 92.
