Nginx配置反向代理支持WebSocket

http {
    #WebSocket代理配置
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
                location /app {
                        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_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection $connection_upgrade;
            
                        proxy_pass http://127.0.0.1:8888/app ;
                }
    }

 

posted @ 2019-11-18 10:28  yshy  阅读(560)  评论(0编辑  收藏  举报