[英]Node https forward proxy client-server
I'm trying to use Node's request module to make a request to https url. 我正在尝试使用Node的请求模块向https url发出请求。 Code snippet below.
下面的代码段。
var request = require('request')
,r = request.defaults(
{'proxy':'https://localhost:8443',
strictSSL: false,
rejectUnauthorized: false,
});
function sendHttpsReq(){
r.get('https://my.https.url/api/model', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
});
}
Using the above code, If i use a http proxy and make a http request, the proxy server gets the request. 使用上面的代码,如果我使用http代理并发出http请求,则代理服务器将获得该请求。 But for a https url through a https proxy, the proxy server never gets the request.
但是对于通过https代理的https URL,代理服务器永远不会收到请求。 I'm using a simple node-http-proxy based proxy server running on my local server.
我正在使用在本地服务器上运行的基于简单节点-http-proxy的代理服务器。
Looks like multiple people had issue with node-http-proxy when using it as https forward proxy. 似乎有很多人将node-http-proxy用作https转发代理时遇到了问题。
The following issues are logged on their github repository. 以下问题记录在其github存储库中。
https://github.com/nodejitsu/node-http-proxy/issues/453 https://github.com/nodejitsu/node-http-proxy/issues/453
https://github.com/nodejitsu/node-http-proxy/issues/454 https://github.com/nodejitsu/node-http-proxy/issues/454
I had to deviate from using node-http-proxy for https forward proxy instead used the code from following blog. 我不得不偏离将node-http-proxy用于https转发代理,而使用了来自以下博客的代码。
http://newspaint.wordpress.com/2012/11/05/node-js-http-and-https-proxy/ http://newspaint.wordpress.com/2012/11/05/node-js-http-and-https-proxy/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.