franciscop / server

:desktop_computer: Simple and powerful server for Node.js
https://serverjs.io/
MIT License
3.56k stars 171 forks source link

including CORS middleware does not effect socket.io #105

Closed paulrobello closed 5 years ago

paulrobello commented 5 years ago

server version 1.0.18 socket.io version ^2.2.0

Server code snippet: server(serverOpts, [ server.utils.modern(cors(corsOptions)), socket('connect', connect) ]); when socket.io on the client side does long polling, server.js is not using my custom cors options to mirror origin, it just sends allow *

Browser Log: Access to XMLHttpRequest at 'http://localhost:1977/socket.io/?EIO=3&transport=polling&t=MTX5gMc' from origin 'http://localhost:1978' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*'

paulrobello commented 5 years ago

Issue seems to be with socket.io 2.2.0, it works fine with socket.io 2.1.0

franciscop commented 5 years ago

Hi @paulrobello, I do not have the bandwidth to look into this. Could you find the origin of the issue? Would you be able to do a PR?

If it's a socket.io issue, could you look into notifying them?

paulrobello commented 5 years ago

It appears to be an issue with engine.io used by socket.io. Closing issue.