webSocket 400

1
2
3
4
5
6
7
8
9
10
11
location /ws/createwebsocket {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://my.api.iaiot.com:8080/ws/createwebsocket;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

webSocket 302

spring-websocket(4.2.5.RELEASE)

spring-websocket 不支持 resin,如果用 resin 部署服务,需基于 com.caucho.websocket.WebSocketListener 自己实现,或者依赖一个其他的 spring 支持的 websocket 包,如:

1
2
3
4
5
<dependency>
    <groupId>io.undertow</groupId>
    <artifactId>undertow-websockets-jsr</artifactId>
    <version>2.0.17.Final</version>
</dependency>

spring-websocket 支持的 RequestUpgradeStrategy: