WebSocket 打开握手超时

WebSocket opening handshake timed out

我正在开发 Google 云计算引擎实例。 Ubuntu 12.04。 我在使用端口 8888 的服务器上安装了一个 Tornado 应用程序,我的 nginx 配置如下所示:

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

upstream chat_servers {
    server 127.0.0.1:8888;
}

server {
    listen 80;
    server_name chat.myapp.com;

    access_log /home/ubuntu/logs/nginx_access.log;
    error_log /home/ubuntu/logs/nginx_error.log;

    location /talk/ {
        proxy_set_header X-Real-IP $remote_addr;  # http://wiki.nginx.org/HttpProxyModule
        proxy_set_header Host $host;  # pass the host header - http://wiki.nginx.org/HttpProxyModule#proxy_pass
        proxy_http_version 1.1;  # recommended with keepalive connections - http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
        # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
        proxy_connect_timeout 7d;
        proxy_send_timeout 7d;
        proxy_read_timeout 7d;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_pass       http://chat_servers;

    }
}

当我尝试通过 Javascript 连接到 ws://chat.myapp.com/talk/etc/ 时,Tornado 应用程序在 WebSocketHandler 上的 open() 方法被调用,我成功地在服务器上打印了日志,但是在客户端,代码永远不会进入 onopen(),一段时间后我得到 1006 error code,WebSocket 打开握手超时`。

此应用程序在具有相同配置的亚马逊 (AWS) EC2 服务器上运行良好,但在我移动到 Google 云后,不知何故无法完成握手。

是否有特定于 Google Cloud 的配置?或者文件上的任何 nginx 更新?

一头雾水,折腾了两天也没解决问题

Ubuntu 上的默认 nginx 版本是 nginx/1.1.19。我将其更新为 nginx/1.8.0。问题解决了。