[BUG] Support HTTPS proxy (https:// scheme) for HTTPS_PROXY environment variable
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code 2.x does not support https:// scheme in the HTTPS_PROXY environment variable, resulting in ERR_SOCKET_CLOSED error when trying to connect.
What Should Happen?
Claude Code should support HTTPS_PROXY=https://... either by using a library like https-proxy-agent internally, or by documenting the limitation with a clear error message
Error Messages/Logs
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_SOCKET_CLOSED
Please check your internet connection and network settings.
Steps to Reproduce
``zsh``
HTTPS_PROXY="https://user:pass@proxy-host:port" claude login
#### Result
Unable to connect to Anthropic services. Failed to connect to api.anthropic.com: ERR_SOCKET_CLOSED
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.193
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
## Environment
- Claude Code: 2.1.193
- OS: macOS 26 (arm64)
- Shell: zsh
## Root cause
The proxy server requires a TLS connection (https:// scheme). Node.js built-in HTTP modules do not support TLS-in-TLS tunneling (connecting to the proxy itself via TLS, then sending a CONNECT request inside that TLS channel). curl supports this since 7.52.0, but Node.js core does not.
## Workaround
Using socat as a local TCP bridge that handles TLS to the proxy:
````
socat TCP-LISTEN:3277,fork,reuseaddr "SSL:proxy-host:port,verify=0" &
HTTPS_PROXY="http://user:pass@127.0.0.1:3277" claude login
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗