我们已宣布
在 Node.js 中注册证书包
Node.js 的默认信任存储包含访问 Amazon 服务所需的证书。在某些情况下,最好只包括一组特定的证书。
在本示例中,使用磁盘上的特定证书创建
https.Agent
,除非提供指定的证书,否则它会拒绝连接。然后,系统会使用新创建的 https.Agent
更新开发工具包配置。
var fs = require('fs'); var https = require('https'); var certs = [ fs.readFileSync('
/path/to/cert.pem
') ]; AWS.config.update({ httpOptions: { agent: new https.Agent({ rejectUnauthorized: true, ca: certs }) } });