All locations active · 99.99% uptime
Protocols

The HTTP CONNECT Method and HTTPS Tunneling

An HTTP proxy can read and forward plain HTTP requests. But what about encrypted HTTPS traffic? If the proxy cannot read the content, how will it forward it? The answer is the CONNECT method: the standard way of telling the proxy "open a raw TCP tunnel to this address and then stay out of it".

How Is the Tunnel Established?

FIGUREEstablishing a tunnel with CONNECT
TUNNELClientHTTP proxyCONNECT ornek.com:443 HTTP/1.1Host: ornek.com:443407 Proxy Authentication RequiredIf authentication is requiredProxy-Authorization: Basic …HTTP/1.1 200 Connection established→ the TLS handshake begins (the proxy does not see it)

After the 200 response, the proxy becomes a "pipe": it passes the incoming bytes to the other side exactly as they are and never looks at the content.

Important

The moment the CONNECT response is 200 Connection established , the proxy stops speaking HTTP. The bytes that follow are the TLS handshake, and the proxy cannot interpret them — it only carries them.

What Does the Proxy See in a CONNECT Tunnel?

FIGUREVisibility layer by layer
VISIBILITYTCP connectionCONNECT lineTLS handshakeHTTP request/responseThe proxy establishes and manages it —fully visibleTarget domain name and port —visibleThe SNI field goes out unencrypted— visibleEncrypted — the proxy cannot see itProxy: target domain name + time + byte count

In other words, HTTPS hides what you are doing but does not hide where you are going . This distinction is critically important when evaluating proxy privacy.

We covered metadata leakage and logging in detail in proxy logs article .

The Difference Between CONNECT and Absolute-URI

In plain HTTP, a different request form is sent to the proxy. The two should not be confused:

Plain HTTP (absolute-URI)HTTPS (CONNECT)
Request lineGET http://site/yol HTTP/1.1CONNECT site:443 HTTP/1.1
Can the proxy see the contentYes, completelyNo
Can it add headersYesNo
Can it cacheYesNo
For each requestA new request lineOne tunnel, many requests

This is why headers such as X-Forwarded-For can only be added in plain HTTP traffic; in HTTPS the proxy cannot touch the headers.

Why Is CONNECT Restricted?

CONNECT is the authority to tell the proxy "open a raw TCP connection to any address". If it is not restricted, the proxy turns into an open relay. That is why most proxy configurations limit CONNECT to specific ports only:

FIGURETypical ports allowed for CONNECT
POLICYPortServiceTypical policy443HTTPSAllowed — standard563NNTPSUsually allowed993IMAPSCase by case465 / 587SMTPSUsually blocked (spam risk)22SSHUsually blocked25SMTPAlmost always blocked

SMTP ports are blocked in order to prevent spam abuse. If you need to carry e-mail traffic, you have to ask your provider for special permission.

Common Errors

FIGUREError responses related to CONNECT
ERRORCODE / SYMPTOMLIKELY CAUSESOLUTION407 Proxy AuthenticationRequiredNo credentials were sentAdd the Proxy-Authorization header403 ForbiddenThe target port is outside the policyAsk your provider for the list of allowed ports502 Bad GatewayThe proxy could not connect to the targetCheck the target address and its reachability504 Gateway TimeoutThe target did not respond in timeIncrease the timeout, check the targetERR_TUNNEL_CONNECTION_FAILEDThe tunnel could not be established in the browserVerify the proxy address, port and credentials

The ERR_TUNNEL_CONNECTION_FAILEDyou see in the browser means that the CONNECT request received a response other than 200. To see the detail, try it with curl.

Inspecting from the Command Line

FIGURESeeing the CONNECT negotiation
Terminal01# curl verbose output — see the CONNECT lines02curl -v -x http://proxy.example.com:8080 https://example.com 2>&1 | grep -E "CONNECT|Proxy|established"0304# Expected output:05# > CONNECT example.com:443 HTTP/1.106# < HTTP/1.1 200 Connection established0708# With authentication09curl -v -x http://proxy.example.com:8080 --proxy-user "kullanici:sifre" \\10 https://example.com 2>&1 | grep -E "CONNECT|407|200"1112# Sending the raw CONNECT request by hand (for learning purposes)13printf "CONNECT example.com:443 HTTP/1.1\\r\\nHost: example.com:443\\r\\n\\r\\n" \\14 | nc proxy.example.com 8080 | head -3

The last command shows how plain the protocol is: sending a few lines of text and receiving a 200 response is enough.

TLS Interception (SSL Inspection)

Instead of establishing the tunnel, some corporate proxies step into the middle: they connect to the target themselves and present the client with a fake certificate signed by the organization's root certificate. When this is done, the proxy can read the encrypted content as well.

How can you tell?

Click the padlock icon in the browser and look at the organization that issued the certificate. If you see the organization's name instead of the public certificate authority you expected, TLS interception is being applied. We covered the topic in our transparent proxy article .

Performance Note: Tunnel Reuse

Once a CONNECT tunnel has been established, several requests to the same target can pass through the same tunnel. This means paying the handshake cost only once. Keeping keep-alive enabled in your client provides a noticeable speed gain in CONNECT-based traffic.

FIGUREThe effect of tunnel reuse
PERFORMANCEFirst request (CONNECT + TLS)186 ms2nd request (same tunnel)62 ms3rd request (same tunnel)58 msIf a new tunnel is opened184 ms0 ms490 ms total

The first request is expensive, the following ones are cheap. A client that opens a new connection for every request pays this difference over and over.

Summary

CONNECT is a simple but powerful mechanism that lets an HTTP proxy carry encrypted traffic. Once the tunnel is established, the proxy cannot see the content; it only knows the target domain name, the time and the amount of bytes. Port policies restrict CONNECT in order to prevent abuse. Reusing the tunnel is critical for performance. To verify your configuration, use our proxy checker tool you can use.

Frequently Asked Questions

01What is the CONNECT method for?

It asks the HTTP proxy to open a raw TCP tunnel to a specific target. HTTPS traffic passes through this tunnel; the proxy cannot see the content, it only carries it.

02What can the proxy see in my HTTPS traffic?

The target domain name (the CONNECT line and the TLS SNI field), the connection time and the amount of bytes transferred. The content, headers and cookies are encrypted, so they are invisible.

03What does ERR_TUNNEL_CONNECTION_FAILED mean?

It means the browser's CONNECT request received a response other than 200. It occurs because of an authentication error, a port policy, or the proxy being unable to reach the target.

04Why does the proxy not allow port 25?

The SMTP port is the classic channel for spam abuse. Almost all providers block this port; if you need to carry e-mail traffic, you have to ask for special permission.

05Does a CONNECT tunnel provide encryption?

No, the tunnel itself is unencrypted. Encryption is provided end to end by TLS. That is why carrying plain HTTP traffic over CONNECT brings no extra security.

Related Articles and Pages

NEXT STEP

Strengthen your proxy setup today.

Get started in minutes with a paid plan, or try our free proxy list first.

FREEPROXY.TR

Looking for a free proxy? You're in the right place

A complete proxy platform where you can browse up-to-date free proxy addresses, compare HTTP and SOCKS proxy types, and check your proxy connections with free tools.