Open guowushi opened 6 years ago
Failed to load http://127.0.0.1:3000/socket.io/?EIO=3&transport=polling&t=MAP6H5v: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
打开server的源码index.js,找到第3行,改为
var io = require('socket.io')(http, { cors: true });
原理就是允许socket.io跨域 或者用nginx也可以
Failed to load http://127.0.0.1:3000/socket.io/?EIO=3&transport=polling&t=MAP6H5v: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.