socket.io交叉原始资源共享问题

发布于 2025-02-06 00:52:01 字数 784 浏览 2 评论 0原文

我们在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷爱 2025-02-13 00:52:01

我通过重新启动AWS服务器实例解决了问题

I have fixed the issue by rebooting the AWS server instance

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文