Search code examples
httptcpproxyreverse-proxyhttp-proxy

Are CONNECT-based http proxies supposed to keep the TCP connection alive?


I wonder how are CONNECT-based http proxies working in terms of TCP. Do they keep the TCP connection alive or recreating one on every request?


Solution

  • The CONNECT method works by having an initial HTTP handshake (CONNECT request and response) and after that passing all data through between client and server in both directions. Thus after the initial HTTP handshake it is basically a tunnel for a bidirectional byte stream, not something with requests and responses anymore. This tunnel is done only on shutdown of the underlying TCP connection.