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 ;
                }
    }

 

你可能感兴趣的:(Nginx配置反向代理支持WebSocket)