mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
We'll now rely on the standard cors module (https://github.com/expressjs/cors), instead of the custom implementation that is error-prone and not really user-friendly. Breaking change: the handlePreflightRequest option is removed by the change. Before: ``` new Server({ handlePreflightRequest: (req, res) => { res.writeHead(200, { "Access-Control-Allow-Origin": 'https://example.com', "Access-Control-Allow-Methods": 'GET', "Access-Control-Allow-Headers": 'Authorization', "Access-Control-Allow-Credentials": true }); res.end(); } }) ``` After: ``` new Server({ cors: { origin: "https://example.com", methods: ["GET"], allowedHeaders: ["Authorization"], credentials: true } }) ```