greim / hoxy

Web-hacking proxy API for node
http://greim.github.io/hoxy/
MIT License
599 stars 97 forks source link

https with upstream proxy #87

Open jvmccarthy opened 8 years ago

jvmccarthy commented 8 years ago

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!

mmaday commented 8 years ago

Looks like you fixed it at https://github.com/jvmccarthy/hoxy/commit/71251f981800ed73b077f4a652c0c38794074c82 ?

jvmccarthy commented 7 years ago

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.

wujichao commented 7 years ago

change protocol of request to http works for me.

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