它适用于http,但升级到https时会发生此错误。
这是我的环境:
配置:
location /cable {
proxy_pass http://my_app;
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 Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
}
从服务器登录:
[2016-12-18T13:07:48.252727 #19764] INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Started GET "/cable" for 162.158.166.199 at 2016-12-18 13:07:48 +0000
[2016-12-18T13:07:48.254025 #19764] INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Started GET "/cable/"[non-WebSocket] for 162.158.166.199 at 2016-12-18 13:07:48 +0000
[2016-12-18T13:07:48.254084 #19764] ERROR -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: )
[2016-12-18T13:07:48.254146 #19764] INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Finished "/cable/"[non-WebSocket] for 162.158.166.199 at 2016-12-18 13:07:48 +0000
我非常感谢你的帮助。
感谢。