How to run Claude Code behind a corporate proxy
To run Claude Code behind a corporate proxy, you need three things from your network team: the proxy URL, your company's root CA certificate if the proxy inspects TLS, and confirmation that the hosts Claude Code talks to are allowed. Put HTTPS_PROXY and, if needed, NODE_EXTRA_CA_CERTS in the env block of ~/.claude/settings.json, start a new session, and run /status to check the Proxy row. That covers most company networks.
The rest of this guide is the detail that makes the difference between "works on my laptop at home" and "works on the office network on day one": which surface reads which file, what to allowlist, and what each error actually means.
Step 1: set the proxy variables
Claude Code respects the standard proxy environment variables. HTTPS_PROXY is the one to set. HTTP_PROXY is the fallback if your proxy does not offer HTTPS. NO_PROXY lists hosts that should skip the proxy, and it accepts either spaces or commas between entries. Lowercase versions work too, and Claude Code uses the first one it finds in this order: https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY.
The proxy variables Claude Code reads
| Variable | What it does | Example value |
|---|---|---|
| HTTPS_PROXY | The proxy for Claude Code's traffic. Set this one first | http://proxy.example.com:8080 |
| HTTP_PROXY | Fallback when no HTTPS proxy is set | http://proxy.example.com:8080 |
| NO_PROXY | Hosts that skip the proxy, separated by spaces or commas | localhost,.internal.example.com |
If the proxy asks for a username and password, put them in the URL: http://username:password@proxy.example.com:8080. Do not paste that into a script or a committed file. Keep it in your user settings, or have your IT team push it through managed settings. You do not need a NO_PROXY entry for localhost to keep Claude Code's own local connections working, since those never go through the proxy.
Step 2: trust your company's certificate
Many corporate proxies inspect TLS traffic. They decrypt and re-encrypt it with a certificate signed by your company's own certificate authority. Any tool that does not trust that authority sees a certificate it cannot verify and refuses to connect.
Claude Code trusts two certificate sources by default: the Mozilla CA set it ships with, and your operating system's certificate store. If your IT team has installed the company root certificate on your laptop, which is normal on managed machines, Claude Code installed with the native installer usually works with no extra setup. npm installs need Node 22.15 or later to read the operating system store. On older Node versions, only the bundled set and NODE_EXTRA_CA_CERTS apply.
If you still get certificate errors, ask IT for the company CA bundle as a .pem file and set NODE_EXTRA_CA_CERTS to its path. If your company also requires client certificates (mutual TLS), set CLAUDE_CODE_CLIENT_CERT and CLAUDE_CODE_CLIENT_KEY to the certificate and key files, plus CLAUDE_CODE_CLIENT_KEY_PASSPHRASE if the key is encrypted. When IT rotates those files, replace them at the same paths: Claude Code re-reads them and retries after a TLS or connection failure, so a running session usually picks up the new pair without a restart.
Step 3: put it where every surface can see it
This is the step most guides skip, and it is the one that causes the "it works in my terminal but not in the app" reports. Claude Code reads shell variables once, at startup. Different surfaces start from different places, so a proxy exported in your .zshrc is not guaranteed to reach all of them.
Where each Claude Code surface reads proxy settings
| Surface | Where to put the proxy and CA variables |
|---|---|
| Desktop app, signed in with your Claude account | The env block of ~/.claude/settings.json. It reads settings like a terminal session |
| Desktop app, when it manages the provider connection (for example a third-party provider) | Only managed settings or ~/.claude/settings.json. A repository's own settings files are ignored for these variables |
| Terminal (CLI) | Shell exports work, but ~/.claude/settings.json is more reliable |
| Background agents | ~/.claude/settings.json or managed settings. Shell exports only reach them by chance |
| A remote Linux machine over SSH from the desktop app | ~/.claude/settings.json on that remote machine, even if its shell profile already exports them |
| Cloud sessions | Not your proxy. The cloud environment manages its own network access |
The background agents row is worth explaining. Background sessions run under a shared supervisor process that inherits the environment of whichever shell started it first. Export the proxy in one terminal and not another, and your background agents work some days and fail on others. The settings file removes the guesswork.
So my default is simple: one env block in ~/.claude/settings.json holding HTTPS_PROXY, NO_PROXY and NODE_EXTRA_CA_CERTS. It covers the desktop app, which is where I tell most people to start, plus the terminal and every background agent. The settings.json guide shows where the env block goes, and Claude Code environment variables covers the other places you can set them.
Step 4: verify before you trust it
Start with curl from the same shell: curl -x with your proxy URL and -I https://api.anthropic.com. On Windows PowerShell use curl.exe so the built-in alias is not used. If that fails, the problem is the proxy or the network, not Claude Code, and no setting inside Claude Code will fix it.
Then start a new Claude Code session and run /status. Three rows matter. Proxy shows the active proxy URL and marks a value it cannot parse as invalid. The mTLS client cert and key rows only appear if those files loaded, so a missing row means the load failed. Additional CA cert(s) shows the NODE_EXTRA_CA_CERTS path but does not prove the file loaded.
For that last one, start Claude Code with claude --debug. The log goes to a file under ~/.claude/debug rather than your terminal. Look for a line saying it appended extra certificates from NODE_EXTRA_CA_CERTS. A Failed to read or Failed to load line tells you exactly which file is wrong. One more useful detail: a proxy URL missing its http:// scheme stops Claude Code at launch with an error naming the variable, so that mistake at least announces itself.
The hosts to ask IT to allow
If your company blocks by default, send IT this list. All traffic is HTTPS on port 443 unless you configure a custom port for something like an LLM gateway or an MCP server.
Hosts Claude Code needs on a locked-down network
| Host | What it is for |
|---|---|
| api.anthropic.com | Model requests and related checks |
| claude.ai, claude.com, platform.claude.com | Signing in with a Claude account or Console account |
| sso.claude.com | Sign-in for organizations using single sign-on |
| downloads.claude.ai | Native installer, auto-updates and plugin downloads |
| mcp-proxy.anthropic.com | MCP connectors set up in your Claude account |
| registry.npmjs.org | npm installs, plugin dependencies and npx-launched MCP servers |
| github.com, raw.githubusercontent.com | Plugin marketplaces and the release notes feed |
| bridge.claudeusercontent.com | The Chrome extension connection |
| *.frame.claudeusercontent.com | Reading artifacts |
| code.claude.com | Documentation lookups from inside a session |
The desktop app needs more than the terminal does, because it loads its own interface from the content hosts: anthropic.com, claude.ai, claude.com and claude.app with their subdomains, plus *.claudeusercontent.com and *.claudemcpcontent.com. Allow claude.ai but block those and you get a blank window, not an error message, which is a miserable thing to debug. If the app opens to a blank screen on the office network but works at home, check this first.
If you run Claude Code through Amazon Bedrock or another cloud provider, model traffic goes to that provider instead of api.anthropic.com. The Bedrock guide covers that route, and the same proxy and CA settings apply to it.
Fixes for common Claude Code proxy errors
Proxy and certificate errors and what fixes them
| What you see | Likely cause | Fix |
|---|---|---|
| Unable to connect to Anthropic services on first run | The startup check could not reach the API or sign-in host within 10 seconds | Check the proxy URL, then ask IT to allow the host the message names |
| Connection refused, a firewall or proxy may be blocking it | No proxy set on a network that requires one, or a leftover ANTHROPIC_BASE_URL pointing at a dead local proxy | Set HTTPS_PROXY, and check settings files for a stale ANTHROPIC_BASE_URL |
| Couldn't connect through your proxy (ERR_PROXY_TUNNEL) | The proxy refused to open the tunnel | Check the proxy credentials and that it allows the host |
| SSL certificate verification failed or SELF_SIGNED_CERT_IN_CHAIN | A TLS-inspecting proxy with a CA Claude Code does not trust | Install the CA in the system store, or set NODE_EXTRA_CA_CERTS |
| Proxy refused the connection: HTTP 407 | The proxy wants credentials it did not get | Add the username and password to the proxy URL |
| Socket is closed mid-response | Often a corporate proxy on Windows dropping a long-running connection | Ask IT about connection timeouts for the API host |
| Desktop app opens to a blank screen | The app's content hosts are blocked | Allow the desktop content hosts listed above |
| Works in the terminal, fails for background agents | Proxy only exported in some shells | Move the variables into ~/.claude/settings.json |
If curl works but Claude Code does not, the cause is usually something local. A disconnected VPN can leave a stale tunnel interface on macOS, WSL can inherit a broken DNS resolver from Windows, and Docker Desktop can intercept outbound traffic. Rule those out before you open a ticket. Claude Code doctor is the quickest way to see what your install thinks is wrong, and the MCP troubleshooting guide covers MCP servers that fail for network reasons.
Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.
Frequently asked questions
How do I use Claude Code behind a corporate proxy?
Set HTTPS_PROXY to your proxy URL, add NO_PROXY for internal hosts that should skip it, and set NODE_EXTRA_CA_CERTS to your company's CA bundle if the proxy inspects TLS. Put them in the env block of ~/.claude/settings.json, start a new session and check the Proxy row in /status.
Does Claude Code support SOCKS proxies?
No. Claude Code supports HTTP and HTTPS proxies through HTTPS_PROXY and HTTP_PROXY. If your network only offers SOCKS, or a proxy that needs NTLM or Kerberos authentication, route Claude Code through an LLM gateway that handles it.
How do I fix SSL certificate errors in Claude Code?
The error usually means a TLS-inspecting proxy is using a certificate Claude Code does not trust. Install your company's root certificate in the operating system store, or set NODE_EXTRA_CA_CERTS to the CA bundle path. Do not set NODE_TLS_REJECT_UNAUTHORIZED=0, which turns off certificate checks entirely.
Why does the proxy work in my terminal but not in the desktop app or background agents?
Shell exports only reach processes started from that shell. The desktop app and the supervisor that runs background agents do not reliably inherit them. Put the proxy and CA variables in ~/.claude/settings.json so every surface reads them.
Which hosts does Claude Code need through a firewall?
At minimum api.anthropic.com for model requests and claude.ai, claude.com and platform.claude.com for sign-in, plus downloads.claude.ai for updates. Plugins, MCP connectors, the Chrome extension and artifacts each add hosts, and the desktop app also needs its content hosts or it opens to a blank screen.
Last reviewed by David Iya on October 30, 2026

