proxy-chain icon indicating copy to clipboard operation
proxy-chain copied to clipboard

Add ability to hijack requests

Open yotamN opened this issue 1 month ago • 1 comments

I want to be able to hijack the proxy traffic, mostly for reading but ideally also for writing. I was thinking of implementing a way to return from prepareRequestFunction a method to handle a request/CONNECT stream instead of the default handling. Something like this:

const server = new ProxyChain.Server({
	port: 8080,
	prepareRequestFunction({ hostname }) {
		return {
			connectTunnelHandler(sourceSocket) {
                            // proxy-chain won't open a target socket
                        }
		};
	},
});

Before working on it, I would like to get feedback to know if it's something welcomed. I know that the CONNECT traffic is encrypted but in cases where breaking the encryption is okay (like my own use case) it can be useful.

yotamN avatar Nov 24 '25 14:11 yotamN

You can already do this, either return a static response with customResponseFunction or use a local web server as the upstream, and there you can do whatever you want.

jancurn avatar Nov 24 '25 21:11 jancurn