Express HTTPS - 无法安全连接 - SSLv3损坏的协议

时间:2015-01-10 19:25:05

标签: node.js express https

尝试使HTTPS服务器在Express 4上运行,但是会出现SSLv3安全错误(请参阅图像)。据我所知,由于POODLE攻击,浏览器不再支持SSLv3协议。

如何让HTTPS服务器使用TLS1.2协议?

var express = require('express'),
app = express(),
fs = require('fs'),
https = require('https'),
key = fs.readFileSync('/usr/local/etc/ssl/key.pem'),
cert = fs.readFileSync('/usr/local/etc/ssl/cert.pem'),
https_options = {
    key: key,
    cert: cert
},
PORT = 8000,
HOST = 'localhost';

https.createServer(https_options.key, app).listen(PORT);

app.get('/', function(req, res) {
  res.send('Hello');
});

module.exports = app;

服务器正在侦听localhost:8000

Results this

错误

1 个答案:

答案 0 :(得分:1)

尝试创建像那样的服务器

它在我这边工作得很好,

var server = require('https').createServer(options, app),
server.listen(port);

或者如果要添加套接字

var server = require('https').createServer(options, app),
io = require('socket.io').listen(server);
server.listen(port);