我正在通过https实现node js脚本。

节点js

const options = {
  key: fs.readFileSync('private.key'),
  cert: fs.readFileSync('cert.crt'),
  // This is necessary only if using the client certificate authentication.
  requestCert: true,
  rejectUnauthorized: true,

  // This is necessary only if the client uses the self-signed certificate.
  ca: [fs.readFileSync('client-cert.pem')]
};


在每个请求上这都会产生错误:-ERR_CERT_AUTHORITY_INVALID

我已经搜索了很多,但没有找到。

我使用以下命令生成客户端密钥:-


  openssl req -x509 -newkey rsa:2048 -keyout client-key.pem -out
  client-cert.pem -days 365


我在服务器上创建并使用.crt和私钥。

我在这里做错了什么?

最佳答案

我做了以下对我有用的事情。
我将浏览器的版本升级到最新版本,并且可以正常工作。在下面的给定链接中找到此链接,以了解如何更新浏览器版本。 https://www.computerhope.com/issues/ch001388.htm

关于node.js - 无法加载资源:net::ERR_CERT_AUTHORITY_INVALID,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52411188/

10-11 22:48
查看更多