奇怪的cors与套接字问题

我正在使用btford.socket-io,并尝试与节点交谈。

它工作正常,但不是我从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. 

我也尝试在我的快递中使用这个 npm设置cors({origin:"*"}) ,但没有运气。

关于这个A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true.

设置允许来源到一个固定的域名将解决这个问题,目前,如果不犯错, http://example.org:5000 。 我相信你应该包括端口号。

我不明白的是为什么你有头上的凭据。