greim/hoxy

https with upstream proxy

Opened this issue · 3 comments

When using an upstreamProxy, https requests don't work. I'm getting the following error with NODE_DEBUG=net,

NET 17108: write failure { [Error: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:
] code: 'EPROTO', errno: 'EPROTO', syscall: 'write' }

Looks like the issue is around ProvisionableRequest. The proxy assumptions are for http requests, which don't make a connect request for https.

Please consider using request since it handles proxying correctly for http and https. Sadly, I doubt I will be able to contribute a fix, but I wanted to submit an issue in case anyone else runs into this.

Thank you for all your efforts on hoxy. It is an important developer resource!

Looks like you fixed it at jvmccarthy@71251f9 ?

I tried to but ran into other issues with request and the connection management. It was somewhat working but after struggling with it for a few days, I had to pull off on my efforts. After struggling with it, I think it would probably be best to support plumbing through the https connect method manually instead of pulling in request. Sadly, because I was running out of time and this and websocket support wasn't working, I fell back to using Fiddler. I'm much rather use hoxy and hope to come back to it at some point.

change protocol of request to http works for me.

proxy.intercept({
	phase: 'request'
}, function(req, resp, cycle) {
	req.protocol = 'http:';
});