Spring WebSocket: confirmation message failed due to invalid Upgrade: null header

I am using wss (secure web sockets) with spring from the backend and STOMP for the javascript client.

Does anyone know why get:

Handshake failed due to invalid Upgrade header: null 
+7
spring spring-websocket websocket
source share
2 answers

I met the same problem with nginx https proxy for tomcat. This is because I do not support the wss request. To support the wss request, I use the configuration as shown below:

 # WebSocketSecure SSL Endpoint # # The proxy is also an SSL endpoint for WSS and HTTPS connections. # So the clients can use wss:// connections # (eg 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"; } } 
+9
source share

Finally, I found a solution.

I had to open https port in tomcat to handle wss requests.

+2
source share

All Articles