Socket.io不设置CORS头(s)

我知道这个问题已经被问了几次了。
但是,我无法得到任何这些解决scheme的工作。
我正在运行node.js和socket.io的标准安装。 (来自Amazon EC2上的yum)
问题在于Chrome正在回退到xhr轮询,并且这些请求需要一个可用的CORSconfiguration。 但是,我似乎无法得到它的工作。 我的Web服务器运行在端口80上,而node.js(socket.io)在端口81上运行。我试图让socket.io使用源策略,如你所见。 我也尝试使用“*:*”作为起源,没有运气。
这是我的代码:

var http = require('http'); var io = require('socket.io').listen(81, {origins: '*'}); io.configure( function(){ io.set('origin', '*'); }); io.set("origins","*"); var server = http.createServer(function(req, res) { io.sockets.emit("message", "test"); res.writeHead(200); res.end('Hello Http'); console.log("Message recieved!"); }); server.listen(82); io.sockets.on('connection', function(client) { console.log("New Connection"); }); 

非常感谢你!

这是我必须用CORS来处理socket.io的语法:

 io.set( 'origins', '*domain.com*:*' ); 

如果涉及到,请使用console.log确保您在./lib/manager.js中的Manager.prototype.handleHandshakeinput了这段代码:

  if (origin) { // https://developer.mozilla.org/En/HTTP_Access_Control headers['Access-Control-Allow-Origin'] = '*'; if (req.headers.cookie) { headers['Access-Control-Allow-Credentials'] = 'true'; } }