# CONNECT

> The `CONNECT` method is used to establish a tunnel to a remote server, often used for HTTPS connections through a proxy.

## What is the HTTP CONNECT method and how do proxies use it?

The request method used to create a tunnel for secure communication, commonly used with proxies to establish a secure HTTPS connection through them.

- Topic: HTTP Methods
- Type: request method

## Example

Wrong:

```http
CONNECT https://example.com/ HTTP/1.1
```

Right:

```http
CONNECT example.com:443 HTTP/1.1
Host: example.com:443
```

The `CONNECT` target is only a host and port; the proxy opens a TCP tunnel and TLS runs inside it.

## Common mistakes

- Running a proxy that allows `CONNECT` to any port, turning it into an open relay.

## Key points

- The proxy allows `CONNECT` only to port 443 or an explicit allow list.
- The proxy requires authentication before opening tunnels.

## Interview questions

### Can a proxy see HTTPS traffic sent through CONNECT?

No, it sees only the host and port, because TLS runs end to end. Only a proxy whose certificate authority the client trusts can intercept it.

### Can fetch send a CONNECT request?

No, `CONNECT` is a forbidden method in `fetch`. Browsers send it themselves when a proxy is configured.

## Related cards

- [Proxy](https://wonderium.dev/web/proxy.md)
- [HTTPS](https://wonderium.dev/web/https.md)
- [TLS](https://wonderium.dev/web/tls.md)
- [HTTP Method](https://wonderium.dev/web/http-method.md)
- [VPN](https://wonderium.dev/web/vpn.md)

---

- Level: [Web Platform](https://wonderium.dev/web.md)
- HTML version: https://wonderium.dev/web/connect
- Last updated: 2026-11-25
