socket.io交叉原始资源共享问题
我们在AWS上托管了套接字服务器,并与4个URL连接。代码库已经在9个月内没有更改,但最近我遇到了一个错误。
错误:
访问XMLHTTPREQUEST的'https:roench''https'https://某物'https://某物'已被CORS策略阻止:no'access-control-allow-allow-origin'标题存在于请求的资源。
获取https:// net :: err_failed 522
套接式服务器紧缩设置:
cors: [{
origin: process.env.CORS,
methods: ["GET", "POST"]
}, {
origin: process.env.CORS2,
methods: ["GET", "POST"]
}, {
origin: process.env.CORS3,
methods: ["GET", "POST"]
},{
origin: process.env.CORS4,
methods: ["GET", "POST"]
},{
origin: process.env.CORS5,
methods: ["GET", "POST"]
}]
});
我们正在使用“ socket.io”:“^4.0.1”
不确定如何解决此问题,
任何帮助感谢
We have our socket server hosted on AWS and it is connected with 4 URLs. The code base hasn't been changed for like 9 months but recently I'm getting an error.
The error:
Access to XMLHttpRequest at 'https:something' from origin 'https://something' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://something net::ERR_FAILED 522
The socket server CORS setting:
cors: [{
origin: process.env.CORS,
methods: ["GET", "POST"]
}, {
origin: process.env.CORS2,
methods: ["GET", "POST"]
}, {
origin: process.env.CORS3,
methods: ["GET", "POST"]
},{
origin: process.env.CORS4,
methods: ["GET", "POST"]
},{
origin: process.env.CORS5,
methods: ["GET", "POST"]
}]
});
We are using "socket.io": "^4.0.1"
Not sure how to fix this issue
Any help is much appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过重新启动AWS服务器实例解决了问题
I have fixed the issue by rebooting the AWS server instance