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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM