无法加载资源:net::ERR_CERT_AUTHORITY_INVALID

Dee*_*yan 9 apache ssl node.js express socket.io

我正在通过 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')]
};
Run Code Online (Sandbox Code Playgroud)

对于每个请求,都会给出错误:- ERR_CERT_AUTHORITY_INVALID

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

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

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

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

我在这里做错了什么?

Fen*_*ang 5

我也遇到过类似的情况,是和证书有关的。它还给出了特定 url 的信息。单击该 url 将提示您访问不安全的内容,单击该 url 将允许通过刷新 url 进行后续访问。

在此输入图像描述


小智 -2

单击页面设置并启用不安全信息重新加载页面。