紧急求助,nginx如何配置spring的websocket
1、利用spring的WebSocketHandlerRegistry注册websocket服务后,在jsp页面初始化时有如下地址
var socketUrl = "ws://localhost:8080/mytest/websocket/server";
var socktJsUrl = "ws://localhost:8080/mytest/sockjs/server";
2、不使用nginx代理没有问题,websocket正常访问,如果使用nginx代理,比如代理后端口为8011,JSP页面运行时,初始化websocket失败,报如下错误。即使把ws://localhost:8080里的端口改为8011也不行。
WebSocket connection to 'ws://localhost:8080/IBM_CCWeb/websocket/server' failed: Error during WebSocket handshake: Unexpected response code: 403
请教下nginx如何配置,才可以。我上网查了很多,都不可以。我看nginx里,还不能写ws协议,比如写ws://localhost:8080/mytest/websocket还报错。