websocket: the client is not using the websocket protocol: ‘upgrade’ token not found in ‘Connection’ head,客户端没有使用websocket协议:'upgrade'令牌未在'Connection'头中找到

错误分析

websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' head

当反向代理或负载均衡未正确传递WebSocket请求时,就会出现此问题。

解决方案

Nginx加上以下解析

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade

Apache加上以下解析

 <Location /ws>
     ProxyPass ws://localhost:8000
     ProxyPassReverse ws://localhost:8000/
 </Location>
原文地址:https://www.cnblogs.com/niuben/p/14607999.html