小编Dee*_*yan的帖子

无法加载资源:net::ERR_CERT_AUTHORITY_INVALID

我正在通过 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 和私钥并使用它们。

我在这里做错了什么?

apache ssl node.js express socket.io

9
推荐指数
2
解决办法
4万
查看次数

标签 统计

apache ×1

express ×1

node.js ×1

socket.io ×1

ssl ×1