cors-origin is weird
Taxtra opened this issue · comments
i am trying to connect * origin to the admin ui, but it doesn't seem to work.
const io = new Server(server, {
cors: {
origin: '*',
credentials: true,
},
});
instrument(io, {
auth: false,
mode: 'development',
});
#35 seems to be the same error
the version in the docs is working for me, but i have to allow all origins.
any solutions?
Hi! If you really need to allow all origins, you can use the following solution:
const io = new Server(httpServer, {
cors: {
origin: (_req, callback) => {
callback(null, true);
},
credentials: true
}
});
Added in the documentation here: https://socket.io/docs/v4/server-options/#cors