Claude Code Proxy Not Working: HTTPS_PROXY Fixes and Check Commands

Blog / Troubleshooting

Claude Code Proxy Not Working: HTTPS_PROXY Fixes and Check Commands

When Claude Code ignores your proxy settings, the cause is usually one of four things: the variable never reached the Claude Code process, you entered a SOCKS address, NO_PROXY excludes Anthropic's domains, or a corporate proxy re-signs traffic with a certificate Node does not trust. According to the official network configuration docs, Claude Code reads HTTPS_PROXY / HTTP_PROXY, does not support SOCKS proxies, and takes self-signed or enterprise root certificates through NODE_EXTRA_CA_CERTS. Below, each symptom comes with a verification command. At the end, you check whether your terminal's real egress matches your browser's.

One note first: this article is only about getting Claude Code to use a network exit you already have and are allowed to use. Claude is not available in some regions. Follow Anthropic's terms of service and local regulations. For background, see Claude says your region is not supported: causes, official policy and compliant options.

First, is it really a proxy problem?

A proxy that is not taking effect and a server-side outage look alike: timeouts, refused connections or 5xx errors. Before debugging the proxy, spend half a minute ruling out the other two possibilities.

  1. Open /en/down/claude-code and see whether other people are reporting "can't connect" or "slow" at the same time, and whether the official status page shows an active incident.
  2. Open /en/status/anthropic to see whether cdnping's probe of api.anthropic.com from the Cloudflare edge looks normal. For reference, here is cdnping's edge probe snapshot from October 17, 2026 (probe location: Cloudflare Denver; cdnping had only just started collecting that day, so the window was a little over an hour). Within the window, the Claude API showed 100% availability, with p50 latency of 73 ms and p95 of 84 ms. These are numbers from an overseas edge node to the API. They do not represent your local experience; they only show that the server side itself was reachable at the time.
  3. If the server side is fine, move on to the local machine. For a fuller layer-by-layer check, see Claude Code connection timeouts and errors: a four-layer network checklist.

Which proxy variables does Claude Code use?

VariablePurposeCommon mistake
HTTPS_PROXYProxy for HTTPS requests; Claude Code relies mainly on this one to reach the APISetting only HTTP_PROXY and assuming that is enough
HTTP_PROXYProxy for plain HTTP requestsBest set to the same address as HTTPS_PROXY
NO_PROXYComma-separated list of hosts that bypass the proxyWriting * or including anthropic.com, so API requests go direct
NODE_EXTRA_CA_CERTSExtra trusted CA certificate file (PEM format)Pointing at a binary .cer file, or getting the path wrong

The proxy address format is http://host:port. If authentication is required, use http://username:password@host:port. The official docs state plainly that SOCKS is not supported, so something like socks5://127.0.0.1:1080 will not work the way you expect. Many local proxy clients also expose an HTTP port, or a mixed port that accepts both HTTP and SOCKS. Use that port.

Use uppercase variable names. Programs handle lowercase https_proxy inconsistently, and uppercase everywhere is the simplest policy. If both the uppercase and lowercase versions exist in your environment with different values, clear one set first.

Symptom 1: you exported it in the terminal, but Claude Code still connects directly

The most common cause is that the Claude Code process never received the variable.

  • You exported it in a different terminal window. Environment variables apply only to the current shell and its child processes. A newly opened window does not have them.
  • You added it to ~/.zshrc but did not reload. Run source ~/.zshrc or open a new terminal.
  • You launch it from an IDE extension. On macOS, GUI apps opened from the Dock or Launchpad generally do not read the exports in your shell config files. In that case, start claude manually from the IDE's built-in terminal to confirm the variable works, or use the settings.json approach in the next section.
  • You run it with sudo. sudo strips most environment variables by default. Don't run Claude Code with sudo unless you have to.

To verify, run this in the same terminal where you plan to start Claude Code:

env | grep -i proxy
echo "$NODE_EXTRA_CA_CERTS"

If you don't see HTTPS_PROXY here, Claude Code won't see it either.

Symptom 2: it is set in settings.json under env. How does that differ from export?

Claude Code lets you set environment variables in the env field of settings.json, for example:

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

(Port 7890 is only an example. Replace it with the HTTP port of your own proxy client.)

How it differs from exporting in the shell:

  • Scope: the env field applies only to Claude Code's own session. It does not affect curl, git or npm that you run in the same terminal. So "curl works but Claude Code doesn't," or the reverse, may simply mean the two sides are configured differently.
  • Layer overrides: user-level, project-level and local-level settings stack, and a project's config can override the value you set at user level. If it works in one directory and not another, check .claude/settings.json and .claude/settings.local.json in the project directory first. For the precedence of each layer, see Claude Code settings.json explained.
  • Set certificate variables before launch: Node reads NODE_EXTRA_CA_CERTS when the process starts. To be safe, export the certificate path in the shell before starting Claude Code instead of relying only on settings.json.

Symptom 3: on Windows the variable is set, but some requests still bypass the proxy

A few Windows pitfalls:

  • cmd and PowerShell use different syntax. In cmd, use set HTTPS_PROXY=http://127.0.0.1:7890. In PowerShell, use $env:HTTPS_PROXY="http://127.0.0.1:7890". Both apply only to the current window.
  • The system proxy is not an environment variable. The system proxy you turn on in Windows Settings is used by browsers, but command-line programs generally do not read it. Claude Code needs environment variables.
  • 127.0.0.1 inside WSL is not the Windows 127.0.0.1. When you run Claude Code in WSL2 and the proxy client runs on Windows, the address must be the Windows host's IP as seen from the WSL network, and the proxy client must allow LAN connections.
  • Child processes lose the variable. Community members have reported that child processes spawned by Claude Code on Windows did not inherit the proxy variables. This depends on the specific version. If you hit it, search the Claude Code GitHub issues by keyword, find the original post, and check whether it is fixed, in progress or closed before deciding to upgrade or work around it. Don't rely on secondhand summaries.

To make it permanent, you can write a user environment variable with setx HTTPS_PROXY "http://127.0.0.1:7890", then reopen the terminal.

Symptom 4: certificate errors, self signed certificate or unable to get local issuer certificate

This means the request reached the proxy, and the proxy connected to the target for you, but the certificate it presented is not trusted by Node. It is common on corporate networks with HTTPS inspection appliances, or with security software that decrypts traffic.

Steps:

  1. Ask IT or your security software to export the root certificate, and save it in PEM format (a text file that starts with -----BEGIN CERTIFICATE-----). If you were given a binary .cer, convert it with openssl x509 -inform der -in corp.cer -out corp.pem.
  2. Set the variable, then restart Claude Code:
export NODE_EXTRA_CA_CERTS=/path/to/corp.pem
claude
  1. Do not turn off certificate verification with NODE_TLS_REJECT_UNAUTHORIZED=0. It makes the error disappear, but it also lets a man-in-the-middle read and tamper with your API key and code.

If your company proxy requires a client certificate (mTLS), the official docs list variables such as CLAUDE_CODE_CLIENT_CERT and CLAUDE_CODE_CLIENT_KEY. Check the current version of the official network configuration docs for details.

Symptom 5: Claude Code works, but MCP still can't connect

An MCP server is a separate program. A local stdio MCP server is a child process launched by Claude Code, and whether its network requests use the proxy depends on whether that program reads proxy variables and which HTTP library it uses. Remote MCP connections work differently again.

Separate the two questions when debugging. First run the MCP program on its own and confirm it can reach its target service in an environment where HTTPS_PROXY is set. Then look at the specific error it reports inside Claude Code. If the target service is on an internal network, add its domain to NO_PROXY; otherwise internal requests get sent to the external proxy.

Symptom 6: it worked before, then stopped using the proxy after an upgrade

Proxy and certificate behavior can regress in a particular version. To check:

  1. Run claude --version and note the current version.
  2. Search the GitHub issues for "proxy", "HTTPS_PROXY" and "NODE_EXTRA_CA_CERTS" plus the version number. See whether the same version has reports and maintainer replies.
  3. If it is confirmed as a regression, stay on the last working version for now and upgrade after a fix is released.

You can also see settings-related version changes in the official changelog. cdnping's /en/changes records additions and removals in Claude's changelog line by line.

Self-check commands you can copy

The commands below assume macOS / Linux. On Windows, run them in WSL or Git Bash. If you use PowerShell, call curl.exe and replace grep and head with their equivalents.

# 1. Check that the variables exist, and whether both upper- and lowercase versions are set
env | grep -i proxy

# 2. Bypass the proxy and see whether a direct connection reaches the API (000 means it can't connect)
curl -sS -o /dev/null -w "direct: %{http_code} connect=%{time_connect}s\n" \
  --noproxy '*' https://api.anthropic.com/

# 3. Go through the proxy explicitly and see whether the proxy itself works
curl -sS -o /dev/null -w "proxy: %{http_code} connect=%{time_connect}s\n" \
  -x "$HTTPS_PROXY" https://api.anthropic.com/

# 4. See the egress IP and region that Claude's side sees through the proxy
curl -sS -x "$HTTPS_PROXY" https://claude.ai/cdn-cgi/trace | grep -E '^(ip|loc|colo)='

# 5. If you use an enterprise certificate, confirm the file is readable and is PEM
head -1 "$NODE_EXTRA_CA_CERTS"

How to read the results:

Step 2Step 3Meaning
000Returns an HTTP status codeThe proxy works. The problem is that the variable isn't reaching Claude Code; go back to Symptoms 1, 2 and 3
000000The proxy itself is down. Check the proxy client, the port and the protocol (did you enter a SOCKS port?)
Returns a status codeReturns a status codeThe network layer is fine at both ends. Look at Claude Code's specific error; it may be authentication, a certificate or a server-side problem
AnyCertificate errorGo back to Symptom 4

A 4xx such as 401 or 404 in step 2 or 3 also counts as "connected." It means the TLS handshake completed and the request reached Anthropic, but it had no valid API key or the path was wrong.

Once inside Claude Code, you can use /status to view the current session's configuration and connection info, and claude doctor to check the installation. The output differs between versions, so go by what you see locally.

Does your terminal's egress match your browser's?

Many people open claude.ai in a browser, see that it loads, and assume the terminal uses the same exit. In practice, browsers often go through the system proxy or an extension, while terminals use environment variables, so the two can be entirely different. Split-routing rules and IPv4/IPv6 dual stack can also give one computer two different exits.

To compare:

  1. Open /en/ip in your browser and look at the IP and region from Claude's Cloudflare trace under "multi-egress detection." Also check whether the "mainland split-routing detection" result says "mainland split routing," "global proxy" or "direct domestic connection." (This is about how traffic is routed relative to mainland China.) For what the three results mean, see How Chinese websites see your real IP.
  2. In the terminal, run the trace command from step 4 above.
  3. Compare ip and loc on both sides. A mismatch is not necessarily wrong, but you need to know which one Claude Code is actually using.

If the terminal's trace returns an IPv6 address while the browser shows IPv4, the cause is most likely dual stack sending the two through different paths. See IPv6 proxy not working: why IPv4 and IPv6 exits differ on dual-stack networks. For how routing rules work, see /en/learn/split-tunneling.

The "latency profile" item on /en/ip compares the round-trip time measured in the browser with the exit's TCP round-trip measured by Cloudflare, to judge whether a relay sits in the path. If the proxy chain is long, every Claude Code request pays that extra delay, and the symptom is "it works but it's slow." That kind of problem needs a latency breakdown, not more tweaking of proxy variables. See Claude Code responses are slow: where the latency comes from and how to find and fix it.

What to watch for with a custom API endpoint

If you point Claude Code at a different endpoint through ANTHROPIC_BASE_URL, whether you need a proxy and how to write NO_PROXY must be decided against that new address, not api.anthropic.com. For example, if the endpoint is hosted in mainland China and reachable directly, add its domain to NO_PROXY so traffic doesn't detour through an overseas proxy. For setup, see Configuring a custom API endpoint for Claude Code, Codex and OpenCode.

Troubleshooting order, in short

  1. Use /en/down/claude-code and /en/status/anthropic to rule out a server-side outage.
  2. Run env | grep -i proxy and confirm the variables are present in the environment that launches Claude Code.
  3. The address is http://, not socks5://.
  4. NO_PROXY contains neither * nor Anthropic's domains.
  5. For certificate errors, point NODE_EXTRA_CA_CERTS at a PEM file. Do not disable verification.
  6. Test with curl once direct and once through the proxy, and use the table to locate which layer is at fault.
  7. Use the trace command and /en/ip to compare the terminal's and the browser's egress.
  8. If the problem appeared only after an upgrade, search the GitHub issues by version number for the original post and its status.

Related articles

Keep reading