【发布时间】:2013-10-08 07:50:21
【问题描述】:
我正在尝试使用 Node 的 request 模块向 https url 发出请求。代码如下:sn-p。
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);
}
});
}
使用上面的代码,如果我使用 http 代理并发出 http 请求,代理服务器会收到请求。但是对于通过 https 代理的 https url,代理服务器永远不会收到请求。我正在使用在我的本地服务器上运行的基于 node-http-proxy 的简单代理服务器。
【问题讨论】:
-
会不会是https代理提供了不可信的证书?
-
@NitzanShaked 这些选项应该通过证书信任。
strictSSL: false,rejectUnauthorized: false
标签: node.js proxy node-http-proxy