nodejs-socketio-chat icon indicating copy to clipboard operation
nodejs-socketio-chat copied to clipboard

run file:///C:/soft/nodews/client/index.html , chrome not work ,but 360 browser(Webkit and Trident) is ok

Open guowushi opened this issue 6 years ago • 1 comments

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.

guowushi avatar Apr 06 '18 03:04 guowushi

打开server的源码index.js,找到第3行,改为

var io = require('socket.io')(http, { cors: true });

原理就是允许socket.io跨域 或者用nginx也可以

htfc786 avatar Nov 19 '22 08:11 htfc786