我使用wss(安全網絡套接字)和後端的spring以及javascript客戶端的STOMP。Spring WebSocket:由於無效而導致握手失敗升級標頭:null
有誰知道爲什麼得到:
Handshake failed due to invalid Upgrade header: null
我使用wss(安全網絡套接字)和後端的spring以及javascript客戶端的STOMP。Spring WebSocket:由於無效而導致握手失敗升級標頭:null
有誰知道爲什麼得到:
Handshake failed due to invalid Upgrade header: null
最後,我找到了解決辦法。
我不得不在tomcat中打開一個https端口來處理wss請求。
你是怎麼做到的?你可以請張貼解決方案嗎?謝謝! –
嗨,有人可以提出這個問題。我有類似的問題,請指導如何解決這個問題。 – jellboi
我遇到了與nginx https代理到tomcat相同的問題。這是因爲我不支持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";
}
}
看起來像我面臨同樣的問題。這個配置在哪裏? –
你能提供更多的細節?春天的版本?你的網頁配置?你在用sockjs嗎?你能複製/粘貼請求和響應頭文件嗎? –