Here are the possible modes for CONNECT
requests:
intercept
: kassette answers with HTTP/1.1 200 Connection established
and pretends to be the target server. If the browser then makes http or https requests on the socket after this CONNECT
request, they will be processed by kassette and pass through the hook method (if any). That's the default mode.
forward
: kassette blindly connects to the remote destination hostname and port specified in the CONNECT
request and forwards all data in both directions. This is what a normal proxy server is supposed to do. The destination hostname and port can optionally be modified in the onProxyConnect method through the setDestination method.
close
: kassette simply closes the underlying socket. This is what servers which do not support the CONNECT
method do.
manual
: kassette does nothing special with the socket, leaving it in its current state. This setting allows to use any custom logic in the onProxyConnect callback. It only makes sense if the onProxyConnect callback is implemented, otherwise the browser will wait indefinitely for an answer.
The mode describing how to process
CONNECT
requests. It can be defined globally through the proxyConnectMode setting or per-request from the onProxyConnect method through setMode.