Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

`curl: (56) CONNECT tunnel failed, response 407`

BeginnerTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → The forward proxy requires authentication (407 Proxy Authentication Required) and curl sent none, or wrong credentials, or the proxy wants NTLM/Kerberos instead of Basic.

Diagnose →

curl -v -x http://proxy.corp:8080 https://example.com 2>&1 | grep -i 'proxy-authenticate'

The Proxy-Authenticate header tells you the scheme (Basic, NTLM, Negotiate).

Fix →

curl -x http://proxy.corp:8080 --proxy-user 'svc_user:pass' https://example.com
curl -x http://proxy.corp:8080 --proxy-ntlm --proxy-user 'DOMAIN\svc_user' https://example.com

URL-encode special characters if credentials are inside HTTPS_PROXY=http://user:p%40ss@proxy:8080.

Prevent → For servers, ask for IP-based allow listing on the proxy or a dedicated service account, not personal credentials in env vars.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies