Error during WebSocket handshake: Unexpected response code: 404@TOC
基于springboot2.x
如果前端使用nginx代理的话,必须要以下配置。
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
实际nginx配置如下:
server {
listen 80;
server_name localhost;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
charset utf-8;
location / {
root /opt/nginx/appproduct-application-front;
index index.html;
}
location /injured-app {
proxy_pass http://127.0.0.1:39092/injured-app;
}
}