How to Set Up a Proxy for Claude Code

Clark
Clark
IPWeb Technical Researcher

Claude Code does not automatically inherit a browser extension or browser-only proxy. The CLI reads its own network configuration, while browser authorization can run in a different process or even on a different host. A reliable setup therefore starts with the terminal process itself, then verifies DNS, TLS, and OAuth behavior separately.

Use one stable endpoint for the first test and keep credentials out of reusable commands, screenshots, and support tickets. Once the terminal path is confirmed, you can compare another approved route without mixing proxy setup with account, region, or OAuth problems.

Quick Answer

Set HTTPS_PROXY or HTTP_PROXY before launching Claude Code, optionally add NO_PROXY, then restart Claude Code so the new environment is loaded. Use /status to check the active proxy and claude --debug when you need more detailed network evidence. Claude Code's documented proxy configuration supports HTTP and HTTPS proxies, but not SOCKS proxies.

Key Takeaways
  • Claude Code reads proxy environment variables at startup; restart the session after changing them.
  • HTTPS_PROXY, HTTP_PROXY, and NO_PROXY are the main proxy variables.
  • Lowercase variants also work, but conflicting variables can make the active route unclear.
  • Claude Code does not support SOCKS proxies through its documented proxy configuration.
  • /status can show the active proxy URL; claude --debug provides deeper diagnostics.
  • A proxy can change network egress, but it cannot fix account eligibility, regional policy, organization permissions, or an expired OAuth code.

Map Which Process Needs the Proxy

Claude Code runs in the terminal, while account authorization may open in a browser. A local terminal, WSL session, SSH host, container, browser profile, and corporate gateway can all use different network paths. Confirm the path that the failing process actually uses before changing any settings.

Process What to verify Useful evidence
Claude Code CLI Which proxy variables the process inherits /status, shell environment, exact error
Browser OAuth Whether the browser uses the intended local or managed route Browser host, authorization result
DNS Whether required Anthropic hostnames resolve Resolver result and host context
TLS Whether a proxy or inspection gateway changes certificate trust Handshake or certificate error
Table 1: Verify the route per process instead of assuming one browser or system setting covers the whole Claude Code workflow.

Configure HTTP and HTTPS Proxy Settings

Anthropic's current Claude Code network configuration documents standard proxy environment variables. Set them before starting Claude Code. For the first test, use one known endpoint and avoid mixing multiple proxy variables unless you know which one should take precedence.

macOS, Linux, or WSL

export HTTPS_PROXY=https://proxy.example.com:8080
export HTTP_PROXY=http://proxy.example.com:8080
export NO_PROXY="localhost,127.0.0.1"

claude

Windows PowerShell

$env:HTTPS_PROXY="https://proxy.example.com:8080"
$env:HTTP_PROXY="http://proxy.example.com:8080"
$env:NO_PROXY="localhost,127.0.0.1"

claude

Lowercase variants such as https_proxy and http_proxy also work. Claude Code uses the first configured value in its documented precedence order, so remove stale variables if you are not sure which route is active.

Important: Claude Code does not support SOCKS proxies through this documented configuration. If a proxy provider offers several protocols, use an HTTP or HTTPS endpoint for Claude Code itself.

Scope note: These shell examples apply directly to standalone Claude Code sessions launched from that terminal. Claude Desktop-managed Code or background-agent sessions can use managed settings or Claude settings files instead of inheriting every value from your interactive shell, so verify the configuration source used by the session you are actually testing.

VS Code settings.json showing http.proxy, https.proxy, and Claude Code http_proxy and https_proxy environment variables
Figure 1: A real VS Code settings.json example showing proxy-related fields for Claude Code. Other token or base-URL entries visible in this local setup are not required for the proxy configuration described here.

Bypass specific destinations with NO_PROXY

NO_PROXY can be comma-separated or space-separated. Use it only for destinations that should not pass through the proxy.

export NO_PROXY="localhost,127.0.0.1,.example.com"

Restart and Verify Claude Code

Proxy environment variables exported in a shell are read when Claude Code starts. A Claude Code session that is already running does not automatically pick up later shell changes. After changing HTTPS_PROXY, HTTP_PROXY, NO_PROXY, or related certificate variables, close the current session and launch Claude Code again.

Inside an interactive session, run /status. Anthropic's current documentation says the status view can show the active proxy URL and flag a proxy value that is invalid or ignored. This is more reliable than assuming the CLI inherited the same route as the browser.

Claude Code terminal welcome screen showing the status command for checking the current setup
Figure 2: Claude Code exposes the /status command for checking the current setup before deeper network troubleshooting.
/status

For deeper diagnostics, start a fresh session with debug logging:

claude --debug

Claude Code writes debug output to its debug directory rather than printing every detail into the terminal. Use that output to confirm network and certificate configuration without exposing passwords, OAuth codes, API keys, or session values.

Verify the Setup End to End

A proxy configuration is not fully verified just because the environment variable exists. Confirm three layers in order: Claude Code sees the intended proxy, the network configuration loads without parsing or TLS errors, and a real Claude Code request completes successfully.

Verification Sequence
  1. Check the active route: run /status and confirm the Proxy entry matches the endpoint you intended to use.
  2. Check configuration loading: restart with claude --debug and review the debug output for proxy, certificate, or ignored-setting errors.
  3. Run a real smoke test: send one minimal non-interactive request and confirm that Claude Code returns the expected response.
claude -p "Reply only with OK"

If the command returns OK, the test verifies more than basic TCP reachability: Claude Code started, authentication was usable, the configured network path reached Anthropic, and a model request completed. If /status shows the correct proxy but this request fails, stop treating the problem as “proxy not configured” and move to the specific error layer shown by the CLI.

Use that distinction in support records. A successful /status result proves that Claude Code loaded a proxy setting; a successful claude -p request provides much stronger end-to-end evidence that the route works for an actual Claude Code request.

Diagnose DNS, TLS, and OAuth in Order

Resolve lower network layers before diagnosing authentication. If the terminal cannot resolve an Anthropic hostname, OAuth is not the first problem. If DNS succeeds but TLS fails, check certificate trust and corporate inspection. Only after the connection is healthy should an HTTP response or browser-to-terminal OAuth symptom be interpreted.

Anthropic's network requirements include endpoints such as api.anthropic.com, claude.ai, claude.com, and platform.claude.com for API requests and account authentication. Restricted corporate environments may need these destinations allowed through the proxy or firewall.

curl -I https://api.anthropic.com
curl -I https://claude.ai

A non-200 HTTP response does not automatically mean the network path failed. At this stage, the main goal is to confirm that DNS resolution works and that the TLS connection can reach the destination. Interpret the HTTP status only after those lower network layers are healthy.

Claude Code terminal showing repeated API Error Connection error and TypeError fetch failed retries
Figure 3: Repeated connection and fetch failures are network symptoms; verify the proxy, DNS, and TLS path before treating them as OAuth errors.

If the browser authorization succeeds but Claude Code remains waiting, or the terminal reports OAuth error: Invalid code, 403, or another authentication-specific error, move to the Claude Code login troubleshooting guide. Do not duplicate OAuth troubleshooting inside the proxy workflow.

If the exact message is App unavailable in region, use the separate Claude Code region-error guide. A proxy test should not be treated as a way to change Anthropic's availability policy.

Use a Stable Route Before Rotation

Start with stable egress because a fixed route makes repeated results comparable. Rotation changes the public IP and can also change location, ISP, ASN, DNS behavior, or upstream path before the original failure is understood.

If a proxy is already configured, first confirm that the same Claude Code process is actually using it. IPWeb's proxy validation guide shows how to compare the visible IP, country, ISP, ASN, protocol, and application scope instead of assuming the route is active.

For approved network QA that requires one consistent residential exit across repeated Claude Code tests, IPWeb Static Residential Proxies can provide a stable comparison endpoint. Use the product's HTTP or HTTPS endpoint with Claude Code; its documented proxy configuration does not support SOCKS proxies. The purpose is repeatable route testing, not account access, region eligibility, or OAuth repair.

Handle Corporate TLS and Authenticated Proxies

If an enterprise proxy performs TLS inspection, the problem may be certificate trust rather than proxy reachability. Claude Code can use the operating system certificate store and can also be configured with an additional CA certificate when required by the organization.

export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem

On Windows PowerShell, use the same variable in the current session:

$env:NODE_EXTRA_CA_CERTS="C:\path\to\corporate-ca.pem"
Anthropic Claude Code GitHub issue reporting a self signed certificate error on WSL
Figure 4: A real Claude Code GitHub issue shows a self-signed certificate failure, a common signal that corporate TLS inspection or CA trust needs attention.

If a proxy requires Basic Authentication, Anthropic documents credentials in the proxy URL. Do not hardcode a real password into reusable scripts, documentation, screenshots, or support tickets. Source the complete proxy value from a protected environment or credential store and redact the secret from diagnostics.

export HTTPS_PROXY="http://username:password@proxy.example.com:8080"

Make a Safe Support Record

Record the proxy scheme, host type, shell, Claude Code version, active proxy result from /status, DNS result, TLS result, browser OAuth host, callback result, and timestamp. Redact proxy usernames and passwords, OAuth codes, browser cookies, authorization headers, API keys, and session links.

A useful support record should show which layer failed without exposing the credentials needed to reproduce the route.

Frequently Asked Questions

Does Claude Code support SOCKS5 proxies?

No. Anthropic's current Claude Code network configuration states that SOCKS proxies are not supported. Use an HTTP or HTTPS proxy endpoint for Claude Code itself.

Why is Claude Code not using the proxy I just configured?

Claude Code reads shell proxy environment variables at startup. If the session was already running when you changed HTTPS_PROXY, HTTP_PROXY, or NO_PROXY, restart Claude Code and check /status again.

How can I check which proxy Claude Code is using?

Run /status in an interactive Claude Code session. The status view can show the active proxy URL and indicate when a proxy value is invalid or ignored. Use claude --debug for deeper network and certificate diagnostics.

Can Claude Code use an authenticated HTTP proxy?

Yes. Basic Authentication can be supplied in the proxy URL. Keep the real credential in a protected environment or credential store, and redact it from scripts, screenshots, logs, and support tickets.

Why does Claude Code fail when the browser OAuth page works?

The browser and terminal can use different network paths or run on different hosts. A successful browser approval also does not prove that the OAuth result returned to the waiting Claude Code process. If the route is healthy, continue with Claude Code-specific login troubleshooting.

Should I use a rotating proxy for the first Claude Code test?

No. Use one stable endpoint first so DNS, TLS, response class, and OAuth behavior can be compared under the same network conditions. Introduce another approved route only after the baseline is understood.

Can a proxy fix a Claude Code account or region error?

No. A proxy changes the network route. It cannot create account entitlement, change organization permissions, repair expired OAuth credentials, or make an unsupported region officially supported.

How do I know my Claude Code proxy setup is actually working?

Verify it in layers. First confirm the intended proxy in /status, then check a fresh claude --debug session for proxy or TLS configuration errors, and finally run a real request such as claude -p "Reply only with OK". A successful model response is stronger evidence than a proxy variable or curl test alone.

Final Thoughts

A reliable Claude Code proxy setup starts with one supported HTTP or HTTPS endpoint, a fresh Claude Code process, and a verified active route. Check /status, inspect a fresh claude --debug session when needed, and finish with a minimal claude -p request before calling the setup verified.

Keep the network path separate from account and regional policy. Stable egress can make route testing repeatable, but Claude Code login, organization permissions, and availability errors still need their own diagnostic paths.

About the author
View all articles
Clark
Clark
IPWeb Technical Researcher

A technical writer specializing in IP proxy services and network architecture. All content is derived from over six years of hands-on experience at a leading IP proxy provider, covering areas such as large-scale proxy network orchestration, optimization of SOCKS5/HTTP protocol stacks, and the dynamics of anti-scraping strategies and countermeasures. The goal is to dissect the engineering logic underpinning network security, stability, and efficiency.

Service areas
Proxy IP network architecture anti-scraping countermeasures protocol optimization for web scraping large-scale data collection engineering

You may be interested in

Perplexity not available in your country cover showing a region unavailable message and checks for account, service status, and network evidence

Why Perplexity Says It Is Not Available in Your Country

A Perplexity country or region warning looks like a network problem, but the wording alone does not tell you whether the entire service, one feature, one account context, or one network path is responsible. The useful question is not “Which IP should I try next?” It is “What exactly failed, on which Perplexity surface, and what changed immediately before the failure?” That distinction matters because Perplexity Search, mobile apps, organization accounts, the API Console, and individual features can have different access conditions. A route test can reveal a network difference, but it cannot prove what Perplexity’s internal eligibility logic is...

Marcus

Marcus

Proxy Network Analyst

Google Search Operators for Better SERP Checks

Google Search Operators for Better SERP Checks

Google search engine syntax includes operators and query patterns that make a search more specific, such as quotation marks for exact phrases, site: for a domain or URL prefix, minus signs for exclusions, before: and after: for date limits, and filetype: for document types. Used well, these operators help SEO teams, analysts, and developers answer a narrower search question before they compare Google results or move to a structured SERP workflow. The important distinction is that search operators control the query, not the entire result environment. They can make a manual check clearer and easier to document, but they do...

Ryan

Ryan

IP Proxy Research Team

How to Use DuckDuckGo Search Operators and !Bangs

How to Use DuckDuckGo Search Operators and !Bangs

DuckDuckGo supports advanced search syntax for narrowing results by domain, file type, page title, URL, and phrase. It also has !bangs, a separate shortcut system that sends a query to another website's own search engine. The useful part is not memorizing every command. It is knowing which tool matches the search task, how far you can trust the syntax, and what to change when a query becomes too restrictive. This guide focuses on that practical workflow rather than treating DuckDuckGo operators as a list of commands. Quick Answer Use site:, filetype:, intitle:, inurl:, quoted phrases, and term modifiers when you...

Ryan

Ryan

IP Proxy Research Team

Ready to scale your data operations?
Join 10,000+ teams using IPWeb to power their web data collection. Start free today.

Strictly anti-abuse

Fraud, automated operation, and unauthorized use are prohibited.

Enterprise-level services

For legitimate commercial and technical use cases only

Risk control and restrictions

Abnormal behavior may trigger service restrictions or termination.

Compliance data use

Data acquisition and use must comply with relevant regulations.

Privacy protection first

The collection or misuse of sensitive personal information is strictly prohibited.

All services are subject to《the Usage Policy》