WebSocket速度很快,您不必(也不应该)禁用它们。
导致此错误的真正原因是Webfactions使用nginx,并且nginx配置不正确。通过设置和,以下是正确配置nginx代理WebSocket请求的方法:
proxy_set_headerUpgrade $http_upgrade;``proxy_set_header Connection $connection_upgrade;
# we're in the http context heremap $http_upgrade $connection_upgrade { default upgrade; '' close;}# the Meteor / Node.js app serverserver { server_name yourdomain.com; access_log /etc/nginx/logs/yourapp.access; error_log /etc/nginx/logs/yourapp.error error; location / { proxy_pass http://localhost:3000; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 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_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; }}这是基于David Weldon的nginxconfig的改进的nginx配置。安德鲁·毛(Andrew
Mao)已经达到了非常相似的配置。
请记住,还要将HTTP_FORWARDED_COUNT环境变量设置为应用程序前面的代理数量(通常为1)。



