might be late, but just in case.
do it like this in src/index.js
const {Server} = require(‘socket.io’)
const io = new Server(strapi.server.httpServer, {
cors: {
origin: “http://localhost:3000”,
methods: [“GET”, “POST”],
allowedHeaders: [“my-custom-header”],
credentials: true
}
})