Socket.io正在处理HTTP,但不支持HTTPS

时间:2015-02-26 09:15:58

标签: node.js ssl express https socket.io

我遇到一个奇怪的问题,而socket.io在HTTP上运行正常,它在HTTPS上发出 404 错误,即使包括:

<script src="/socket.io/socket.io.js" />

以下是我的快速设置:

HTTP

var server = app.listen(app.get('port'), function() {
    console.log("Express server listening on port " + app.get('port'));
});
io = socketio.listen(server);

HTTPS

var httpsServer = https.createServer({
    key: privateKey,
    cert: certificate,
    ca: [c1, c2, c3],
    requestCert: true,
    rejectUnauthorized: false
}, app);

io = socketio.listen(server);

httpsServer.listen(app.get('port'), function() {
    console.log("Express server listening on port " + app.get('port'));
});

除了socket.io,一切都在HTTPS上正常工作。

0 个答案:

没有答案