# net::ERR_TUNNEL_CONNECTION_FAILED con proxy: cause e soluzioni

> net::ERR_TUNNEL_CONNECTION_FAILED con proxy in Chrome, Playwright o Puppeteer: il tunnel CONNECT è fallito. Trova lo stato nascosto e fixalo.

- URL: https://crawlrelay.com/it/docs/errors/err-tunnel-connection-failed/
- Ultimo aggiornamento: 2026-10-13
- Publisher: CrawlRelay (https://crawlrelay.com)

Errore di rete Chromium: il messaggio esatto in ogni strumento, le cause probabili in ordine e la soluzione che funziona.

**Risposta rapida — Cosa significa ERR_TUNNEL_CONNECTION_FAILED con un proxy?**

**net::ERR_TUNNEL_CONNECTION_FAILED** significa che Chrome ha chiesto al proxy di aprire un tunnel verso un sito HTTPS e il proxy non ha risposto `200 Connection established`. Il browser nasconde lo stato reale. Con proxy residenziali CrawlRelay, la causa è generalmente credenziali mancanti in Playwright o Puppeteer, poi un target che il gateway non può raggiungere. Riproduci con `curl -v` per vedere il codice reale.

## ERR_TUNNEL_CONNECTION_FAILED a colpo d'occhio

| Attributo | Valore |
| --- | --- |
| Errore | ERR_TUNNEL_CONNECTION_FAILED |
| Tipo | Errore di rete Chromium |
| Inviato da | Il tuo browser, dopo che il proxy ha rifiutato o fallito la richiesta CONNECT |
| Definito in | CONNECT method: RFC 9110, section 9.3.6 |
| Riprovarlo? | Solo dopo scopri lo stato reale |
| Prima verifica | Riproduci con curl -v per vedere lo stato reale del CONNECT |

## Cosa significa ERR_TUNNEL_CONNECTION_FAILED?

Per caricare una pagina HTTPS tramite un proxy HTTP, il browser prima invia `CONNECT host:443`. Se il proxy risponde 200, il browser inizia TLS dentro il tunnel. Qualsiasi altra risposta, tipo 407, 403 o 502, interrompe il tentativo e Chromium mostra un errore generico.

Ecco perché questo errore dice dove è fallito il tentativo, il tunnel, ma non il perché. Il perché è il codice stato che il proxy ha inviato, che puoi vedere con curl.

## Com'è ERR_TUNNEL_CONNECTION_FAILED in Python, curl, Node.js e browser?

Lo stesso errore si presenta in modo diverso in ogni strumento. Questi sono i messaggi da cercare nei log:

- **Playwright:** `page.goto: net::ERR_TUNNEL_CONNECTION_FAILED at https://...`
- **Puppeteer:** `Error: net::ERR_TUNNEL_CONNECTION_FAILED at https://...`
- **Barra degli indirizzi di Chrome:** 'Impossibile raggiungere questo sito' con il codice `ERR_TUNNEL_CONNECTION_FAILED`
- **Selenium con Chrome:** lo stesso codice all'interno di un `WebDriverException`

## Cosa causa ERR_TUNNEL_CONNECTION_FAILED?

Probabilmente prima:

- **Nessuna credenziale inviata** (407 nascosto). Chrome ignora nome utente e password all'interno di `--proxy-server`.
- **Una destinazione rifiutata** (403 nascosto), come una categoria bloccata dalla policy di utilizzo del proxy.
- **Una destinazione irraggiungibile** (502 o 504 nascosto): un host morto, un errore di battitura o un fallimento DNS in uscita.
- **Una porta sbagliata**: puntare il browser sulla porta SOCKS5 come se fosse HTTP, o viceversa.

## Come diagnostico ERR_TUNNEL_CONNECTION_FAILED passo dopo passo?

1. Esegui la stessa URL con curl usando `-v` (comando qui sotto) e leggi la linea dopo `CONNECT`.
2. Un `407` indica le credenziali; un `403` una destinazione rifiutata; un `502` o `504` il target o l'uscita.
3. Conferma che il browser usi la porta HTTP per un server proxy `http://`.
4. Testa una pagina semplice come `https://api.ipify.org` prima del tuo vero target.

*Testa l'URL che fallisce con curl (porta HTTP, verbose)*

```bash
# Use the URL that fails; with https://api.ipify.org instead, you test the gateway alone.
# "HTTP/1.1 200 Connection established" first, then the site's own status: the site answered.
curl -v -x http://USERNAME:PASSWORD@gw.crawlrelay.com:7777 https://TARGET_URL

# Same test through the SOCKS5 port, with DNS resolved at the exit
curl -v --socks5-hostname gw.crawlrelay.com:7778 --proxy-user USERNAME:PASSWORD https://TARGET_URL
```

## Come risolvo ERR_TUNNEL_CONNECTION_FAILED?

- **Playwright:** passa `server`, `username` e `password` nell’opzione `proxy`, per browser o contesto. Vedi la [guida Playwright](https://crawlrelay.com/it/docs/playwright/).
- **Puppeteer:** lancia con `--proxy-server=http://host:port` e chiama `page.authenticate()` prima del primo `goto`. Vedi la [guida Puppeteer](https://crawlrelay.com/it/docs/puppeteer/).
- **Selenium:** esegui un piccolo forwarder locale che aggiunge le credenziali. Vedi la [guida Selenium](https://crawlrelay.com/it/docs/selenium/).
- **Controlla la destinazione** rispetto alla nostra [Acceptable Use Policy](https://crawlrelay.com/it/acceptable-use/).

*Playwright (Python): credenziali come campi separati*

```python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(proxy={
        "server": "http://gw.crawlrelay.com:7777",
        "username": "USERNAME-country-us",
        "password": "PASSWORD",
    })
    page = browser.new_page()
    response = page.goto("https://api.ipify.org")
    print(response.status, page.inner_text("body"))
    browser.close()
```

## Devo riprovare dopo ERR_TUNNEL_CONNECTION_FAILED?

Riprova solo quando conosci lo status nascosto. Un 407 o 403 nascosto si ripete all’infinito; correggi la configurazione. Un 502 o 504 nascosto può essere ritentato su una nuova uscita, come qualsiasi errore di gateway.

## Come si applica ERR_TUNNEL_CONNECTION_FAILED a CrawlRelay?

La porta HTTP di CrawlRelay trasporta HTTPS tramite tunnel `CONNECT`, supportati da tutti gli strumenti basati su Chromium. Usa la porta HTTP per i browser: Chromium non supporta SOCKS5 con nome utente e password.

Gateway: `gw.crawlrelay.com`, porta 7777 (HTTP, HTTPS tramite CONNECT) e porta 7778 (SOCKS5). Formato username: `USERNAME-country-{cc}-state-{state}-city-{city}-zip-{zip}-asn-{asn}-session-{id}-ttl-{minutes}`. Correlato: [407 Proxy Authentication Required](https://crawlrelay.com/it/docs/errors/407-proxy-authentication-required/) · [ERR_PROXY_CONNECTION_FAILED](https://crawlrelay.com/it/docs/errors/err-proxy-connection-failed/) · [Guida Playwright](https://crawlrelay.com/it/docs/playwright/).

## ERR_TUNNEL_CONNECTION_FAILED: domande frequenti dagli sviluppatori

### Perché curl funziona ma Playwright mostra ERR_TUNNEL_CONNECTION_FAILED?

Perché curl invia le credenziali dall’URL del proxy, mentre Chromium ignora le credenziali scritte nell’indirizzo del server proxy. In Playwright, passa `username` e `password` come campi separati dell’opzione `proxy`. In Puppeteer, chiama `page.authenticate()` prima della navigazione.

### Posso usare proxy SOCKS5 con autenticazione su Chrome?

Non direttamente. Chromium supporta i proxy SOCKS5 ma non l’autenticazione con nome utente e password SOCKS5. Usa invece la porta HTTP del gateway, che gestisce siti HTTPS con tunnel CONNECT, o esegui un forwarder locale che autentica per il browser.

### ERR_TUNNEL_CONNECTION_FAILED è causato dal sito web?

Raramente direttamente. Il tunnel è tra il browser e il proxy, quindi l’errore avviene prima che il sito veda un handshake TLS. Il sito può essere la causa indiretta se è irraggiungibile e il proxy risponde 502 o 504 alla richiesta CONNECT.

## Altri errori proxy in questo riferimento

- [401 Unauthorized vs 407](https://crawlrelay.com/it/docs/errors/401-unauthorized/)
- [403 Forbidden](https://crawlrelay.com/it/docs/errors/403-forbidden/)
- [407 Proxy Authentication Required](https://crawlrelay.com/it/docs/errors/407-proxy-authentication-required/)
- [429 Too Many Requests](https://crawlrelay.com/it/docs/errors/429-too-many-requests/)
- [502 Bad Gateway](https://crawlrelay.com/it/docs/errors/502-bad-gateway/)
- [503 Service Unavailable](https://crawlrelay.com/it/docs/errors/503-service-unavailable/)
- [504 Gateway Timeout](https://crawlrelay.com/it/docs/errors/504-gateway-timeout/)
- [Cannot connect to proxy (ProxyError)](https://crawlrelay.com/it/docs/errors/cannot-connect-to-proxy/)
- [Connection reset by peer (ECONNRESET)](https://crawlrelay.com/it/docs/errors/connection-reset/)
- [ERR_PROXY_CONNECTION_FAILED](https://crawlrelay.com/it/docs/errors/err-proxy-connection-failed/)
- [ERR_TUNNEL_CONNECTION_FAILED](https://crawlrelay.com/it/docs/errors/err-tunnel-connection-failed/)
- [Read timed out (ReadTimeout)](https://crawlrelay.com/it/docs/errors/read-timeout/)
- [SOCKS5 proxy errors](https://crawlrelay.com/it/docs/errors/socks5-proxy-errors/)
- [SSL: CERTIFICATE_VERIFY_FAILED](https://crawlrelay.com/it/docs/errors/ssl-certificate-verify-failed/)
- [SSL: WRONG_VERSION_NUMBER](https://crawlrelay.com/it/docs/errors/ssl-wrong-version-number/)

**Proxy residenziali con documentazione che copre i casi di errore** Proxy residenziali CrawlRelay da 0,50 USD/GB, traffico che non scade mai. [Vedi i prezzi](https://crawlrelay.com/it/pricing/) · [Avvio rapido](https://crawlrelay.com/it/docs/)

---

CrawlRelay: CrawlRelay è un servizio di proxy residenziali rotanti e proxy mobili 4G/5G primo per sviluppatori: traffico pay-as-you-go senza scadenza da 0,50 USD/GB, pagato in crypto, senza caricamento documenti. Senza KYC — niente documento, selfie o altri documenti. Paga in crypto.
