nginx 代理websocket

 和server平级,添加以下配置

  map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
  }  

 

server里配置添加


 # socket连接地址 
   location /dami/banner/notice {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host; 
    proxy_redirect off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_pass http://127.0.0.1:8099/banner/notice;
    # socket默认连接时长 
    proxy_read_timeout 600s;
  }

 

上一篇:remote gdb


下一篇:springboot整合mybatis