7

I'm getting the following error in Firefox

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/socket.io/?EIO=3&transport=polling&t=1422586440181-21. This can be fixed by moving the resource to the same domain or enabling CORS."

I checked these other stack overflow questions, but no success yet. Also note that io.set is not supported in the latest socket.io and my attempts at server configuration have failed.

Socket.io + Node.js Cross-Origin Request Blocked

how to set socket.io origins to restrict connections to one url

How to enable CORS on Firefox?

and I have tried adding these statements to my server:

io.origins('http://localhost:3002')

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
Community
  • 1
  • 1
user137717
  • 2,005
  • 4
  • 25
  • 48

0 Answers0