Error during WebSocket handshake: Unexpected response code: 404

直接访问IP和端口是没有问题,用了nginx之后产生了问题。

经查找,需要在nginx中设置(红色部分)。

server {
         listen       80;
         server_name jsjnks.test.com;
         charset utf-8;
         location / {
             proxy_pass http://jsjnks;
             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_redirect  off; 
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         }       
         location /public {
             alias  "D:/app/nginx/html/public";
         }   
         location /jsjnks-static {
             alias  "D:/app/nginx/html/jsjnks-static";
         }           
     }

Error during WebSocket handshake: Unexpected response code: 404

上一篇:js控制台 console 骚操作-打印图片-自定义样式-字符画


下一篇:JSON与XML之间的区别