axiak / filternet

A proxy library that provides easy hooks to manipulate http and https traffic consistently.
https://github.com/axiak/filternet
BSD 3-Clause "New" or "Revised" License
101 stars 32 forks source link

Standard SSL proxy #12

Open smsohan opened 9 years ago

smsohan commented 9 years ago

Hi, I'm trying to set up a standard SSL proxy with MITM for some research work. Say, I'm trying to create a MITM proxy for *.github.com

I've created the local CA as in the example and I see the sockets created in /tmp as per the example ssl proxy. However, I cannot get it to serve data as intended.

echo $http_proxy
http://localhost:9000
echo $HTTPS_PROXY
https://localhost:9000
export HTTPS_PROXY=http://localhost:9000
curl https://api.github.com/users/smsohan/repos
curl: (56) Proxy CONNECT aborted 

Here's my code, see the transSslPort config is set to undefined.

var myProxy = proxy.createProxyServer({
                                        sslCerts: sslCerts,
                                        sslSockDir: '/tmp',
                                        port: 9000,
                                        // transSslPort: 9001,
                                        via: 'my test proxy/1.1' // use false to turn off via
                                    });

In the code, I see the server waits for an upgrade event to start the sslProxy. Do I need to do something to trigger this? Thank you for your amazing code.