user1539179
user1539179

Reputation: 1885

Can you use Keep-Alive with a CONNECT request with an HTTP proxy?

I know that with HTTP/1.1 proxies, it's possible to use Keep-Alive to keep a persistent connection with the proxy and from the proxy to the remote server, but I'm curious if/how that would work with an HTTPS connection. I know that to do this, the browser sends a CONNECT request to the proxy to establish a connection then begins communicating using HTTPS. I'm curious if it's possible to use Keep-Alive with HTTPS through an http proxy.

Upvotes: 1

Views: 2686

Answers (1)

Vasiliy Faronov
Vasiliy Faronov

Reputation: 12310

Simply put, CONNECT is always keep-alive.

In HTTP, “persistent connection” means a connection that persists after one request-response pair. But CONNECT establishes a tunnel through the proxy. The proxy cannot even see the requests and responses that are sent over this tunnel (because they are encrypted). So there is no way for this tunnel to not be persistent.

Of course, if the server (the target of CONNECT) decides to close the connection, then the tunnel is destroyed, too. So the server must support persistent connections (just as with a regular, non-TLS proxy).

Upvotes: 3

Related Questions