gpt4 book ai didi

node.js - Node.js https.request : How to point to . PEM 的内部证书颁发机构 (CA)?

转载 作者:太空宇宙 更新时间:2023-11-03 22:18:06 25 4
gpt4 key购买 nike

我最近从 Node 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,这些调用就会起作用,但我想开始利用 Node 0.10.5 中改进的安全性。

我相信我的 .pem 文件很好,因为它可以与 Python httplib2 (${python}/Lib/site-packages/httplib2/cacerts.txt) 和 cURL ("curl-ca-bundle.crt") 配合使用。

最佳答案

好吧,也许这些有帮助,

/whatever/path/ 必须是您项目的相对文件夹。

关于node.js - Node.js https.request : How to point to . PEM 的内部证书颁发机构 (CA)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16430442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com