Hi,
Could multiple origins be supported in a later version of Socket.IO-node so we may specify either an array of origins or a comma separated list of origins?
Thanks.
What was the verdict on this?
I've had the same problem. There is nothing about that in docs but it's already available in socket.io.
It should be a list with spacebars.
Example:
io.set('origins', 'http://domain.com:* http://domain.org:* http://domain.net:* http://domain.gov:*');
Those :* are important. Without it, it will not work.
The :* is for specifying ports and yes it won't work without it.
@Gut6 FYI, your sample code cause security issues.
io.set('origins', 'http://domain.com:* http://domain.org:* http://domain.net:* http://domain.gov:*');
will be processed at here
https://github.com/socketio/socket.io/blob/e0b2cb0c5a9af768a48c43f65643412cc8edc7df/lib/index.js#L87
so omain.com
, main.com
, ain.com
will be passed.
You must use array instead of string, like this:
io.set('origins', ['domain.com:*', 'domain.org:*', 'domain.net:*', 'domain.gov:*']);
Most helpful comment
I've had the same problem. There is nothing about that in docs but it's already available in socket.io.
It should be a list with spacebars.
Example:
io.set('origins', 'http://domain.com:* http://domain.org:* http://domain.net:* http://domain.gov:*');
Those :* are important. Without it, it will not work.