springboot + websocket + centos7服务器(nginx)404问题解决

springboot + websocket + centos7服务器(nginx)404问题解决_第1张图片
解决办法添加下面两行:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;

具体配置:

 location /{
      proxy_set_header    X-Forwarded-For    $proxy_add_x_forwarded_for;
      proxy_set_header    Host  $host;
      proxy_set_header    X-Forwarded-Proto   https;
      proxy_set_header    X-real-IP  $remote_addr;
      proxy_set_header    X-Forwarded-proto  $scheme;    

	 //添加这两行即可
      proxy_set_header Upgrade $http_upgrade;
	  proxy_set_header Connection "upgrade";

      proxy_connect_timeout   240;
      proxy_send_timeout    240;
      proxy_read_timeout    240;
      proxy_pass    http://localhost:8080;
      proxy_redirect ~^http://([^:]+)(:\d+)?(.*)$ https://$1$3;    
  }
            

你可能感兴趣的:(linux)