MyGit

2.4.1

socketio/socket.io

版本发布时间: 2021-01-07 18:34:03

socketio/socket.io最新发布版本:2.5.1(2024-06-19 17:36:33)

This release reverts the breaking change introduced in 2.4.0 (https://github.com/socketio/socket.io/commit/f78a575f66ab693c3ea96ea88429ddb1a44c86c7).

If you are using Socket.IO v2, you should explicitly allow/disallow cross-origin requests:

const io = require("socket.io")(httpServer, {
  allowRequest: (req, callback) => {
    callback(null, req.headers.origin === undefined); // cross-origin requests will not be allowed
  }
});
io.origins(["http://localhost:3000"]); // for local development
io.origins(["https://example.com"]);

In any case, please consider upgrading to Socket.IO v3, where this security issue is now fixed (CORS is disabled by default).

Reverts

Links:

相关地址:原始地址 下载(tar) 下载(zip)

查看:2021-01-07发行的版本