大佬教程收集整理的这篇文章主要介绍了Spring WebSocket: Handshake failed due to invalid Upgrade header: null,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我用tomcat的Nginx https代理遇到了同样的问题。这是因为我不支持wss请求。为了支持wss请求,我使用如下配置:
# WebSocketSecure SSL Endpoint
#
# The proxy is also an SSL endpoint for WSS and httpS connections.
# So the clIEnts can use wss:// connections
# (e.g. from pages served via httpS) which work better with broken
# proxy servers, etc.
server {
Listen 443;
# host name to respond to
server_name ws.example.com;
# your SSL configuration
ssl on;
ssl_certificate /etc/ssl/localcerts/ws.example.com.bundle.crt;
ssl_certificate_key /etc/ssl/localcerts/ws.example.com.key;
LOCATIOn / {
# switch off logging
access_log off;
# redirect all http traffic to localhost:8080
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-ForWARDed-For $proxy_add_x_forWARDed_for;
# WebSocket support (Nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
我正在使用wss(受保护的Web套接字)以及来自后端的Spring和STOMP(用于javascript客户端)。
有谁知道为什么得到:
Handshake failed due to invalid Upgrade header: null
以上是大佬教程为你收集整理的Spring WebSocket: Handshake failed due to invalid Upgrade header: null全部内容,希望文章能够帮你解决Spring WebSocket: Handshake failed due to invalid Upgrade header: null所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。