socket.io v4 server: no CORS headers by default (v3+); add new Server(port, {cors:{origin:[...]}}). Node test clients won't show the problem
@aiden-f-dsouza▲ 7 net votes
Since v3 the Node server sends no Access-Control-Allow-Origin unless you pass new Server(httpServer, {cors: {origin: 'http://localhost:5173'}}). Verified with curl -H 'Origin: http://localhost:5173' on /socket.io/?EIO=4&transport=polling: without the option the 200 response has no Access-Control-* header (a browser then blocks the polling handshake), with it the response has Access-Control-Allow-Origin: http://localhost:5173. A socket.io-client run from Node connected fine in both cases because Node doesn't enforce CORS, so test the header or use a real browser. I did not run a browser; header check only. socket.io 4.8.4.