Angularjs 套接字io出现奇怪的cors问题

Angularjs 套接字io出现奇怪的cors问题,angularjs,node.js,sockets,express,cors,Angularjs,Node.js,Sockets,Express,Cors,我正在使用btford.socket-io,并尝试与node对话 它工作正常但在我从localhost:5000更改为example.org后,情况并非如此,如下所示: .factory('socket',function(socketFactory){ //working var myIoSocket = io.connect('http://localhost:5000'); //not working var myIoSocket = io.conn

我正在使用btford.socket-io,并尝试与node对话

它工作正常但在我从localhost:5000更改为example.org后,情况并非如此,如下所示:

.factory('socket',function(socketFactory){
     //working
     var myIoSocket = io.connect('http://localhost:5000');
     //not working
     var myIoSocket = io.connect('http://example.org:5000');

      mySocket = socketFactory({
        ioSocket: myIoSocket
      });

    return mySocket;
})
我在控制台中发现了这个错误

XMLHttpRequest cannot load http://example.com:5000/socket.io/?EIO=3&transport=polling&t=LIGH5VO. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:8100' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.
:8100/#/app/completed:1 XMLHttpRequest cannot load http://example.com:5000/socket.io/?EIO=3&transport=polling&t=LIGH7BS. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:8100' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

我还尝试在我的express中使用npm设置
cors({origin:“*”})
,但没有成功。

这与
有关
当凭据标志为true时,不能在“Access Control Allow origin”头中使用通配符“*”。

将allow origin设置为固定域将修复此问题,如果我没有弄错的话,
http://example.org:5000
。我相信你应该包括港口号码


我不太清楚的是,为什么要打开标题凭据。

在哪里?我无法设置,因为我的客户端请求是移动应用,没有任何域。我已在套接字客户端中设置。包括端口号是什么意思?cors()