When something goes wrong with Claude Code, the instinct for many people is "my cover has been blown": the IP looks fake, the fingerprint doesn't match, the address has been flagged. In practice, the more common finding is the exact opposite — there was never any cover. The routing rules are correct, you paid for a static IP, and Claude Code still connects straight out of your home broadband, because the proxy client has only ever proxied the browser.
This is the classic Claude Code not using proxy scene: everything looks fine in the browser, while the terminal is full of real addresses.
Why does one computer have two network paths?
- Browser path: Chrome, Safari and Electron apps read the operating system's proxy settings. Turn on "System Proxy" in the client and every browser tab follows automatically.
- Terminal path: command-line programs don't read system proxy settings, only the environment variables HTTPS_PROXY, HTTP_PROXY and NO_PROXY. If those are empty, they connect directly.
Claude Code runs in the terminal, and so do the git, npm and curl you use alongside it.
An analogy: turning on the system proxy is like hanging a "please use the side door" sign at the front gate. Browsers read the sign; command-line programs don't, because nobody ever told them to look.
So the check page in your browser reports everything is fine while Claude Code is connecting directly — the check page is itself a browser, and it can only prove that the browser path works.
What should you actually avoid?
Contradicting yourself. Before getting into how to fix things, let's be clear about the goal. For Claude Code the goal isn't "look like nobody in particular", it's don't contradict yourself.
The signals a platform can observe are limited, roughly these:
- Egress IP, ASN, network type: exposed, just like the browser
- DNS resolver location: exposed
- IPv6 address: exposed, and often not routed through the proxy
- TLS fingerprint: exposed, coming from its Node.js runtime and different from a browser's
- User-Agent: claude-cli style, not a browser UA
- Timezone and language: exposed, taken from system settings
- Canvas, WebGL, fonts: nonexistent
The API request says you're in the US, the DNS resolver says Shanghai, the IPv6 address belongs to a domestic carrier — each of the three is fine on its own, but together they're a contradiction. And a state where "the terminal isn't using the proxy at all" turns several of these into contradictions at once: the browser leaves through the proxy egress, the terminal leaves through your home broadband, and the same account shows two sources within a few minutes.
The three settings below exist to eliminate those contradictions.
How do system proxy mode and TUN mode differ?
Many proxy clients offer another mode: no cooperation from programs needed, they intercept all traffic at the network layer. Clash / Mihomo and v2rayN call it TUN mode, Shadowrocket calls it enhanced mode. In this mode the terminal is captured too, because the interception happens below the application layer.
The difference between the two modes:
| System proxy | TUN mode | |
|---|---|---|
| Browser | follows | follows |
| Terminal / Claude Code | doesn't follow | follows |
| Need to set HTTPS_PROXY | yes | no |
| Is DNS captured | usually not | usually yes |
| Is IPv6 captured | no | depends on config |
So when troubleshooting, the client's mode name is worth checking before the rule list.
If you insist on system proxy mode, you have to set environment variables for the terminal by hand, or write them into Claude Code's settings.json; see the full Claude Code proxy setup walkthrough.
Can a browser's test score be applied to Claude Code?
No. Browser environment checks look at what a web page can observe: Canvas, WebGL, fonts, screen size, timezone, language, WebRTC, DNS resolver. Claude Code is a command-line program that renders no web pages, so Canvas, WebGL and fonts simply don't exist as signals for it.
The signals Claude Code actually exposes are far fewer — just the items listed above. However good the fingerprint spoofing in your browser is, it does nothing for Claude Code; conversely, what you really need to manage on the Claude Code side is the egress, DNS, IPv6 and system timezone.
Setting one: why pin the node?
Most clients have an "automatically pick the fastest node" group: url-test, fallback, load-balance, or a UI label that says "Auto". They're fine for everyday browsing but bad for long sessions, because they switch nodes in the middle of one.
Claude Code holds a long-lived connection and streams its output, so switching nodes mid-session means switching egress IP mid-session, and the session breaks with it. "Pick the fastest" in other words means "it switches egress whenever it feels like it". Pick a node manually, then don't touch it.
Setting two: how do you make DNS follow the egress?
Routing rules decide where TCP connections go out, but not where DNS queries are sent. Those are two independent paths, and a resolver in the wrong country exposes your location all by itself (how DNS works: Cloudflare's DNS explainer).
Two workable approaches:
- Resolve on the proxy side: Clash's fake-ip mode hands the program a placeholder address first, and the real domain resolution is done by the proxy side, so the query never leaves from the local resolver.
- Route the DNS query itself through the proxy: route port 53 traffic to the proxy outbound, or point the client's DNS at a resolver reached through the egress.
One caveat with fake-ip: things that must resolve locally — printers, NAS, local dev domains, corporate intranet — need to be added to fake-ip-filter, or they won't connect. Add to the filter list rather than turning fake-ip off.
Setting three: how do you close the IPv6 hole?
Many rule sets are written for IPv4 only. If your broadband has IPv6 and the client isn't capturing it, you get IPv4 through the proxy and IPv6 direct. Mobile networks and more and more home broadband connections have IPv6 on by default.
Either approach works: have the client capture IPv6, or turn IPv6 off on the network adapter running Claude Code. The one thing you can't do is leave it on and ignore it.
Where do you change these in each client?
Menu names change between versions; below is "where to look", so go by what your installed version shows.
Clash / Mihomo (desktop)
- Capture the terminal: turn on TUN mode, set stack to system or gvisor
- DNS follows the egress: in the dns section set enhanced-mode: fake-ip, and use a resolver reached through the proxy for nameserver
- IPv6: turn IPv6 off, or add IP-CIDR6 rules for IPv6 ranges
- Pin the node: use type: select for the Claude group in proxy-groups, not url-test
v2rayN / v2rayNG
- Capture the terminal: turn on TUN mode, not just system proxy
- DNS follows the egress: route port 53 to the proxy outbound
- IPv6: add IPv6 ranges to the routing rules
- Pin the node: use a single outbound, avoid load balancing
- Sniffing: enable traffic sniffing and set destOverride to http and tls. Otherwise, when a connection arrives as a bare IP, domain rules have nothing to match, and a rule list that looks complete quietly misses connections
Shadowrocket (iOS)
- Capture all traffic: set global routing to "Config" and turn on enhanced mode
- DNS follows the egress: dns-server in the [General] section of the config file
- IPv6: ipv6 = false, or point IPv6 rules at the proxy
- Pin the node: choose the node manually, don't use auto-select
Rule order is the same in every client: exact domain → suffix → keyword → IP range → fallback. Full rules: the complete Claude Code routing rule list.
How do you verify it in four steps?
Do them in order; each step assumes the previous one passed:
- Step one, compare egress: in the terminal running Claude Code, run curl https://ipnet.coffee, then open the Claude check page in a browser. If the two IPs differ, the terminal isn't captured — fix the mode first and put everything else aside.
- Step two, look into the egress: look up that IP's ASN (definition: ARIN's ASN explainer), network type and blacklists in the in-depth IP score. This step tells you what the egress is, not whether your rules took effect.
- Step three, check DNS: run the deep mode of the DNS leak test and look at the resolver's country, not just pass or fail. For the terminal side, see how to check for Claude Code DNS leaks.
- Step four, check IPv6: confirm whether an IPv6 address is exposed and where it points. Then restart the proxy client and the terminal and repeat step one — environment variables and DNS caches linger after a config change.
Step one answers "is the proxy being used at all"; steps two through four answer "is the proxy being used correctly". Skip step one and you may spend the whole time testing the wrong path.
What can this prove, and what can't it?
If all four steps pass, the Claude Code process really does leave through the egress you configured, DNS resolves from a consistent location, and there's no IPv6 bypass. That rules out the whole "the terminal wasn't using the proxy at all" class of problem.
What it can't prove is whether the platform will therefore stop asking you to verify. Egress, DNS and timezone being self-consistent only removes contradictions; it doesn't mean the account is in a high-trust state. Worth saying plainly, so nobody mistakes configuration for a guarantee.
FAQ
Why does the browser show a normal IP while Claude Code is not using proxy?
Because the browser reads the system proxy settings, while command-line programs only read environment variables such as HTTPS_PROXY and HTTP_PROXY. If those variables are empty, they connect directly. The check page is itself a browser, so it can only prove that the browser path works.
TUN mode or system proxy — which should I pick?
For terminal tools like Claude Code, TUN mode is less hassle: you don't have to set environment variables for each program, and DNS and IPv6 are easier to capture along with everything else. System proxy mode requires setting environment variables by hand.
With TUN mode on, do I still need HTTPS_PROXY?
No. TUN intercepts at the network layer, so programs don't need to cooperate. But if you set the environment variables earlier, remember to clear them, or they may point at a local port that no longer exists.
Why must I pin the node?
Claude Code is a long-lived connection with streaming output. An auto-select group switches mid-session, which means switching egress IP mid-session, and the session breaks with it. Pick a node manually and leave it alone.
Do I need to restart after changing the config?
Yes. Environment variables and DNS caches linger after a config change, so restart the proxy client and the terminal before testing if you want accurate results.



