Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js https.request的内部证书颁发机构(CA):如何指向.PEM?_Node.js_Https_Certificate_Ssl Certificate - Fatal编程技术网

Node.js https.request的内部证书颁发机构(CA):如何指向.PEM?

Node.js https.request的内部证书颁发机构(CA):如何指向.PEM?,node.js,https,certificate,ssl-certificate,Node.js,Https,Certificate,Ssl Certificate,我最近从节点0.8.xx更新到了0.10.5。突然,我的https.request调用开始失败。我相信0.8.x不是在验证证书,但0.10.5是。我们建立了一些内部证书颁发机构来验证内部https流量。我想向Node.js https.request客户端显示证书。我该怎么做 目前,我得到: Problem with request: UNABLE_TO_VERIFY_LEAF_SIGNATURE 我试过: var https_request_options = { host: 'm

我最近从节点0.8.xx更新到了0.10.5。突然,我的https.request调用开始失败。我相信0.8.x不是在验证证书,但0.10.5是。我们建立了一些内部证书颁发机构来验证内部https流量。我想向Node.js https.request客户端显示证书。我该怎么做

目前,我得到:

Problem with request:  UNABLE_TO_VERIFY_LEAF_SIGNATURE
我试过:

var https_request_options = {
    host: 'myhost.com',
    path: '/thepath',
    port:  443,
    method: 'POST',
    headers: {
        'Content-type': "application/x-www-form-urlencoded",
        'Content-length': thebody.length,
    },
    // rejectUnauthorized: false,
    ca: [fs.readFileSync('/whatever/path/ca_certs.pem')]
};

var authRequest = https.request(https_request_options, function(response) {
    ....
如果我设置了
rejectUnauthorized:false
,调用就会起作用,但我想开始利用节点0.10.5中改进的安全性


我相信我的.pem文件很好,因为它与Python httplib2(${Python}/Lib/site packages/httplib2/cacerts.txt)和cURL(“cURL ca bundle.crt”)一起工作。

好吧,也许这些有帮助

/which/path/
必须是项目的相对文件夹