【问题标题】:Websocket handshake error message on AWS EC2, NginxAWS EC2、Nginx 上的 Websocket 握手错误消息
【发布时间】:2015-06-25 03:59:06
【问题描述】:

我能够正确接收套接字发出的消息,但每当页面在开始时加载时,我仍然会收到此握手错误。

WebSocket connection to 'ws://example.com/socket.io/?EIO=3&transport=websocket&sid=SBznqHMs6-4SHOdSAAAq' failed: Connection closed before receiving a handshake response

我正在使用 nginx 代理将流量定向到多个 node.js 应用程序。这些是我的 nginx 配置。

upstream app1 {
    ip_hash;
    server 127.0.0.1:3004;
}

server {
    listen 0.0.0.0:80;

    server_name example.com;

    location / {
        proxy_pass http://app1;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-NginX-Proxy true;
        proxy_cache_bypass $http_upgrade;
    }

}

虽然套接字工作正常,但这个握手错误让我很困扰。希望遇到此错误的任何人都可以了解我:)

【问题讨论】:

    标签: amazon-web-services nginx websocket socket.io


    【解决方案1】:

    【讨论】:

    • 我用谷歌搜索了解决方案,但似乎都没有帮助我。
    猜你喜欢
    • 2020-03-06
    • 1970-01-01
    • 2016-09-20
    • 1970-01-01
    • 2013-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多