https:// localhost返回ERR_SSL_PROTOCOL_ERROR(安全连接)

时间:2018-02-12 18:00:33

标签: javascript node.js express https localhost

我正在使用Node和express.js来构建我的服务器,我设置了我的https服务器(基本上)就像这样:

const privateKey  = fs.readFileSync('./credentials/rippal.key', 'utf8');
const certificate = fs.readFileSync('./credentials/rippal.crt', 'utf8');
const credentials = {key: privateKey, cert: certificate};

const app = express();
setup(app, config);

let httpsServer = https.createServer(credentials, app)

httpsServer.listen(3333, function () { 
    console.log("Server listening on port 3333...\n");
});

使用自签名证书,它仍适用于http://localhost:3333,但当我尝试访问https://localhost:3333时,Chrome告诉我

This site can’t provide a secure connection
localhost sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

我应该如何访问https://localhost:3333

谢谢!

0 个答案:

没有答案