CONNECT

Term side of the Card.
Topic: HTTP Methods
Unit title: CONNECT
Categories: Request method
Explanation side of the Card

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

Example

Wronghttp
CONNECT https://example.com/ HTTP/1.1
Righthttp
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.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy