nginx 配置websocket 400 问题

在本地调试中是正常的。配置到服务器中,有nginx反向代理,会出现websocket 400错误

nginx 配置websocket 400 问题

chunk-vendors.dd3a3558.js:1 WebSocket connection to 'ws://192.168.111.20:8074/endpointChat/313/rvcnhy5n/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

需要nginx中配置 :

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