HTTP CONNECT
The HTTP method that asks a proxy to open a raw tunnel, which is how HTTPS travels through an HTTP proxy.
CONNECT asks a proxy to establish a TCP tunnel to a destination and then relay bytes without interpreting them. It is the mechanism that lets encrypted HTTPS traffic pass through a proxy that otherwise speaks HTTP.
#The exchange
CONNECT api.example.com:443 HTTP/1.1
Host: api.example.com:443
Proxy-Authorization: Basic dXNlcjpwYXNz
HTTP/1.1 200 Connection established
After the 200, the TLS handshake happens end to end between your client and the destination. The proxy relays ciphertext.
#What the proxy can and cannot see
- Can see: the destination hostname and port, connection timing, and the volume of bytes transferred.
- Cannot see: the URL path, headers, request body or response body.
This is why an HTTPS request through a proxy is far more private than a plain HTTP one — and why a proxy provider can still report which domains you contacted.
#Reference
CONNECT is defined in RFC 9110, which specifies current HTTP semantics.