← Blog

How-to5 min read

Configuring Claude Code and Codex behind a proxy, firewall, or custom CA certificate

How to configure HTTPS_PROXY, NO_PROXY, custom CA certs (NODE_EXTRA_CA_CERTS, CODEX_CA_CERTIFICATE) and mTLS for Claude Code and Codex, plus SOCKS limits.

Mirasim agent and model picker for switching to reachable providers or local models behind restricted networksMirasim agent and model picker for switching to reachable providers or local models behind restricted networks

The short answer

Claude Code reads HTTPS_PROXY / HTTP_PROXY and NO_PROXY at startup (HTTP/HTTPS only — SOCKS proxies are not supported) and trusts custom root certificates via NODE_EXTRA_CA_CERTS or the OS trust store. Codex trusts corporate root certificates via CODEX_CA_CERTIFICATE (falling back to SSL_CERT_FILE). Set the variables before launching the CLI so the process picks them up.

NeedClaude CodeCodex
HTTP / HTTPS proxyHTTPS_PROXY / HTTP_PROXY / NO_PROXYHTTPS_PROXY / HTTP_PROXY / NO_PROXY
SOCKS proxyNot supported (use HTTP/HTTPS proxy)Use HTTP/HTTPS proxy for predictable TLS & WebSocket
Custom CA bundle (PEM)NODE_EXTRA_CA_CERTSCODEX_CA_CERTIFICATE (fallback: SSL_CERT_FILE)
Proxy mangles gzip bodiesCLAUDE_CODE_GZIP_REQUEST_BODIES=0Check proxy streaming / compression passthrough
Client cert (mTLS)CLAUDE_CODE_CLIENT_CERT + CLAUDE_CODE_CLIENT_KEYConfigure through enterprise gateway / proxy

Claude Code proxy, CA store, and mTLS

Claude Code checks proxy variables in the order https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY once at startup (or reads them from the env block of your user settings.json). Loopback WebSockets (localhost, 127.0.0.0/8, ::1) never go through the proxy.

Proxy and custom CA environment variables for Claude Code
# HTTP/HTTPS proxy (SOCKS proxies are not supported)
export HTTPS_PROXY="http://proxy.example.com:8080"
export NO_PROXY="localhost,127.0.0.1,.internal.example.com"

# Trust a corporate TLS-inspection root CA
export NODE_EXTRA_CA_CERTS="/etc/ssl/certs/company-ca.pem"

# Disable gzip request compression if a TLS proxy rejects compressed bodies
export CLAUDE_CODE_GZIP_REQUEST_BODIES=0
  • OS trust store vs. bundled CAs: by default Claude Code trusts both bundled Mozilla CAs and your OS trust store (CLAUDE_CODE_CERT_STORE=bundled,system). The native installer always reads the OS store; npm installs need Node 22.15 or later.
  • mTLS rotation without restart: set CLAUDE_CODE_CLIENT_CERT, CLAUDE_CODE_CLIENT_KEY (and optional CLAUDE_CODE_CLIENT_KEY_PASSPHRASE). From v2.1.232, Claude Code automatically re-reads rotated cert/key files on TLS handshake or connection-reset errors.
  • Desktop security scope: in app-managed Claude Desktop sessions, proxy and certificate variables are read only from managed settings and user settings.json — repo-level settings are ignored so an untrusted repo can't redirect traffic.

Codex behind a corporate TLS proxy

If codex login or streaming responses fail with TLS or certificate errors behind a corporate proxy, point CODEX_CA_CERTIFICATE at your company's PEM CA bundle. Codex uses it across HTTPS requests, login flows, and WebSocket connections, and checks it before SSL_CERT_FILE.

Providing a corporate PEM bundle to Codex
export HTTPS_PROXY="http://proxy.example.com:8080"
export CODEX_CA_CERTIFICATE="/etc/ssl/certs/company-ca.pem"
codex login

Working smoothly across networks in Mirasim

  • Keeps your local CLI network config: Mirasim launches your installed Claude Code and Codex CLIs directly, so existing HTTPS_PROXY, NO_PROXY, NODE_EXTRA_CA_CERTS, and CODEX_CA_CERTIFICATE settings keep working.
  • Switch to reachable endpoints or local models per session: when one upstream is blocked or flaky on your current network, switch that session to a provider your network reaches (DeepSeek, Kimi, GLM, Qwen, or a local Ollama / mlx-lm model) or run on Mirasim credit without rewriting shell profiles.

Questions

Does Claude Code support SOCKS5 proxies?
No. Anthropic's network configuration docs explicitly state that Claude Code does not support SOCKS proxies — expose an HTTP or HTTPS proxy port instead and set HTTPS_PROXY.
Why does Claude Code ignore proxy changes I exported after starting it?
Claude Code reads shell environment variables once at startup. Quit and relaunch claude after exporting HTTPS_PROXY, or put the variables in the env block of your user settings.json.
Which variable takes precedence in Codex: CODEX_CA_CERTIFICATE or SSL_CERT_FILE?
CODEX_CA_CERTIFICATE takes precedence over SSL_CERT_FILE across HTTPS, login, and WebSocket clients.

Sources

Checked on November 29, 2026 against Anthropic's Enterprise network configuration docs (code.claude.com/docs/en/network-config) and OpenAI's Codex environment variables docs (learn.chatgpt.com/docs/config-file/environment-variables). Check those pages for the latest variables.

Keep reading