score:1

Accepted answer

passing the cors parameters into the socketio constructor resolved the issue, as follows:

const io = socketio(server,{
  cors: {
    origin: "http://localhost:3000",
    methods: ["get", "post"],
    credentials:true
  }
});

score:0

double check at your allowedheaders and allowed methods, working example:

const corsoptions = {
    allowedheaders: ['x-access_token', 'access-control-allow-origin', 'authorization', 'origin', 'x-requested-with', 'content-type', 'content-range', 'content-disposition', 'content-description'],
    credentials: true,
    methods: 'get,head,options,put,patch,post,delete',
    origin: ['http://macog.local:5001','http://localhost:5001', 'https://app.foo.com', 'http://10.0.2.2:5001'],
    preflightcontinue: false
};

Related Query

More Query from same tag