plhwin / nodejs-socketio-chat

A simple chat demo by using Node.js and Socket.IO
595 stars 358 forks source link

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

Open guowushi opened 6 years ago

guowushi commented 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.

htfc786 commented 1 year ago

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

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

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