【发布时间】:2019-01-24 08:48:09
【问题描述】:
我正在使用以下代码在我的网站上安装 SSL 证书:
const express = require('express');
const path = require('path');
const app = express();
const fs= require('fs');
let privateKey = fs.readFileSync('certificate/x.key', 'utf8');
let ca = fs.readFileSync('certificate/x.crt', 'utf8');
let certificate = fs.readFileSync('certificate/x.crt', 'utf8');
let credentials = { key: privateKey, cert: certificate, ca: ca };
const http = require('http');
const https = require('https');
app.use(express.static(path.join(__dirname, 'build')));
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
let httpsServer = https.createServer(credentials, app);
httpsServer.listen(443);
这是一个 react 应用,我通过 Node.js 提供服务。
当我在 Chrome 或 Microsoft Edge 上打开网站时,它显示连接是安全、加密和有效的,但当我在 Firefox 上打开它时,它显示连接不安全。
可能是什么问题?
【问题讨论】:
-
Firefox 是否读取了正确的证书?你也清除缓存并检查了吗?
-
我应该如何验证它正在读取正确的证书?它虽然在 chrome 和 Edge 中工作。是的,我清除了缓存,问题仍然存在
-
只需点击高级,导航到站点并检查站点加载了什么证书。
-
错误代码是:SEC_ERROR_UNKNOWN_ISSUER,当我点击它时,它显示了一个我没有传递到代码中的证书。
-
嗯,很有趣。证书的颁发者是谁?
标签: node.js firefox amazon-ec2 ssl-certificate