The HTTP CONNECT method is a type of HTTP request that is used to establish a tunnel to the origin server, as specified by the target of the HTTP request. Once the HTTP Connection is made, it is intended to be used for the forwarding of data packets in both directions. This can be used to create an end-to-end virtual HTTP connection through one or more proxies.
A HTTP request of this type is sent by the client to an HTTP Proxy Server to establish a two-way HTTP Connection with the resource. The server is responsible for making the HTTP connection, which may utilize additional proxy servers as part of the HTTP connection.
The client can optionally include the Proxy-Authorization HTTP request header field. If Authorization to use the proxy is required but not supplied by the client, it will result in a 407 Proxy Authentication Required status code being returned.
In this example, the client is requesting a HTTP Connection to the origin server on port
80. The Proxy-Authorization request HTTP header includes a
username:password pair using the basic Authentication protocol.
CONNECT www.example.re:80 HTTP/1.1
Proxy-Authorization: basic RXhhbXBsZTphaQ==
The HTTP CONNECT request method is used to set up two-way communication between the client and the resource on the origin server, through one or more proxy servers. The operation is not safe, idempotent, or cacheable.