0
我遇到了IE和CORS的问题。在IE上使用socket.io客户端发生CORS错误
在我的页面 “mysite.com”,我做的:
客户端:
<script src="http:// assets.mysite.com/bundle.js"> //without the space
在资产服务器,我有:
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
的bundle.js是一个连接到套接字服务器的浏览器模块:
var socket = require('socket.io-client')("http: //mysocketserver.com:5000/api");
Chrome和Firefox没有问题,一切都完美加载,建立连接等。在IE(令人惊讶的是)事情并不那么好。
SEC7118: XMLHttpRequest for http://mysocketserver:5000/socket.io/?EIO=3&transport=polling&t=1430944033665-4&sid=jvRj85_i_1ZgwTumAABK required Cross Origin Resource Sharing (CORS).
我检查了一切。 IE浏览器使用相同的运输为Chrome和FF,插座要求对所有的浏览器下面的标题:
Access-Control-Allow-Credentials true
Access-Control-Allow-Origin http:// mysite.com
但是IE仍然拒绝连接,并且,我想不通为什么。
它实际上是IE11,并且在我的gf的PC上运行,它位于我的旁边。去图...无论如何,IE浏览器的成功率已经很高了。 – xShirase