greim/hoxy

Not working with HTTPS

Opened this issue · 1 comments

I am making a proxy with Electron and I use this code

var proxy = hoxy.createServer({
	certAuthority: {
		key: localhost.key,
		cert: localhost.cert
	},
	tls: {
		key: localhost.key,
		cert: localhost.cert
	}
}).listen(45682, () => {
	console.log("Server started listening on port 45682");
});
proxy.log('error warn debug info', (event) => {
	//console.error(event.level + ': ' + event.message);
	//if (event.error) console.error(event.error.stack);
});
proxy.intercept("response", (req, resp, cycle) => {
	console.log("Intercepted response");
	win.webContents.send("response", {
		req: req,
		res: resp
	});
});
proxy.intercept("request", (req, resp, cycle) => {
	//console.log("Intercepted request");
});

Before I added tls and certAuthority options it worked but only on HTTP now it doesn't work at all. I just get site didn't send any data errors on my browser sometimes no internet errors. Am I doing something wrong the certificates are for localhost and are in my localhost object.

remove this and give it another try

tls: {
		key: localhost.key,
		cert: localhost.cert
	}

And you need to make your browser trust your private CA