Fix Playwright ERR_TUNNEL_CONNECTION_FAILED Proxy Errors
Resolve Chromium ERR_TUNNEL_CONNECTION_FAILED, ERR_PROXY_CONNECTION_FAILED, and SOCKS5 auth crashes in Playwright and Puppeteer proxy clusters.
1. Quick Wire-Level Diagnostic Probe
Confirm HTTP CONNECT succeeds cleanly from the exact Docker container or VPS running Playwright before launching Chromium.
curl -v -x "http://proxy_user:proxy_pass@gate.proxytee.com:8080" https://example.com -o /dev/nullCommon Symptoms
- page.goto() aborts with net::ERR_TUNNEL_CONNECTION_FAILED or net::ERR_PROXY_CONNECTION_FAILED
- Playwright works locally without a proxy but fails on headless Linux CI or Docker
- Chromium ignores credentials inside server: 'socks5://user:pass@host:port'
- HTTPS targets fail while plain HTTP pages load normally
2. Primary Root Causes
Chromium Does Not Support Authenticated SOCKS5 Directly
Passing socks5:// with username/password into Chromium launch options triggers ERR_NO_SUPPORTED_PROXIES or tunnel failure; Chromium requires HTTP/HTTPS proxies for credential auth.
Credentials Embedded Inside Server String
Playwright rejects credentials embedded inside proxy.server; username and password MUST be passed as dedicated keys in the proxy config object.
Missing IP Whitelist on Passwordless SOCKS5
Using passwordless SOCKS5 in Playwright without whitelisting your server's public IPv4 causes the upstream socket to close immediately.
3. Step-by-Step Remediation Checklist
Use ProxyTee HTTP/HTTPS Endpoint for Playwright Auth
Pass server: 'http://HOST:PORT' with separate username and password properties inside chromium.launch({ proxy: ... }).
Or Whitelist Server IP for Passwordless SOCKS5
Call POST /v1/add-whitelist/ with your container's outbound IPv4 and clear user:pass if your workflow requires SOCKS5 inside Chromium.
Reuse Browser Launch Proxy Across Contexts Safely
On Windows/Linux, set per-context proxies cleanly or launch with a placeholder proxy at launch time so Chromium initializes its proxy auth handler.
Ignore TLS Errors Only in Controlled Diagnostics
Never disable ignoreHTTPSErrors in production anti-bot checks—verify clean CONNECT tunneling first.
4. Production Fix Code (Clean Playwright Proxy Config (Node.js) Without ERR_TUNNEL_CONNECTION_FAILED)
javascriptimport { chromium } from 'playwright';
const browser = await chromium.launch({
headless: true,
proxy: {
server: 'http://gate.proxytee.com:8080',
username: process.env.PROXYTEE_USER,
password: process.env.PROXYTEE_PASS,
},
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://ipinfo.io/json', { waitUntil: 'domcontentloaded', timeout: 30000 });
console.log(await page.textContent('body'));
await browser.close();Recommended Next Steps for Zero-Block Execution
ERR_TUNNEL Troubleshooting FAQs
Upstream Chromium intentionally blocks username/password authentication on SOCKS5 proxies. Use ProxyTee's HTTP/HTTPS gateway when authenticating via credentials, or whitelist your server IP via /v1/add-whitelist/ to use passwordless SOCKS5.