title: Nginx load balancer websocket issue
body: <p>I'm new in NGINX and WebSocket systems but as per my project requirements I need to check some complex things to finish.</p>
  
  <p>I'm trying to create one example using NGINX, which handles my WebSocket (Port: 1234) and HTTP Requests (Port: 80) using same Url (load balancer url).</p>
  
  <p>I'm using three NGINX server, one as Load Balancer (10.0.0.163) and other two as my application server where I have installed my real APIs, 10.0.0.152 and 10.0.0.154 respectively. Right now, I have configured WebSocket on my application servers.</p>
  
  <p>As per above configuration, my all requests will pass over 10.0.0.163 (load balancer) and it's proxy setting will pass the request (HTTP/WebSocket) to my application server (10.0.0.152/154).</p>
  
  <p>Note : Each application server contain separate Nginx, php, websocket</p>
  
  <p>Here is default (location : /etc/nginx/sites-available/) file for 10.0.0.154 server, which handles WebSocket and HTTP requests on same domain.</p>
  
  <pre><code>server{
      listen 80;
          charset UTF-8;
          root /var/www;
          index index.html index.htm index.php
          server_name localhost 10.0.0.154 ;
      location ~ \.php$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          include fastcgi_params;
      }
      location / {
              try_files $uri $uri/ @proxy;    autoindex on;
      }
      location @proxy{
          proxy_pass http://wb1;
      }
      location =/ {
                  proxy_pass http://wb;       
                  proxy_http_version 1.1;
                  proxy_buffers 8 16k;
                  proxy_buffer_size 32k;
                  proxy_set_header Upgrade $http_upgrade; 
                  proxy_set_header Connection "upgrade";
                  proxy_set_header Host $host;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        Referer                 $http_referer;
          proxy_redirect off;
  
          }
  
  }
  </code></pre>
  
  <p>Following is default file (location : /etc/nginx/sites-available/) for load balancer at 10.0.0.163.</p>
  
  <pre><code>upstream wb{
      server 10.0.0.154;
      server 10.0.0.152;
  }
  
  server{
      listen 80;
          charset UTF-8;
          root /var/www;
          index index.html index.htm index.php
          server_name 10.0.0.163 ;
  
      location / {
              try_files $uri $uri/ @proxy;    autoindex on;
      }
      location @proxy{
          proxy_pass http://wb;
      }
      location =/ {
                  proxy_pass http://wb;       
                  proxy_http_version 1.1;
                  proxy_buffers 8 16k;
                  proxy_buffer_size 32k;
                  proxy_set_header Upgrade $http_upgrade; 
                  proxy_set_header Connection "upgrade";
                  proxy_set_header Host $host;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        Referer                 $http_referer;
          proxy_redirect off;
  
          }
  
  }
  </code></pre>
  
  <p>I found that, load balancer is working properly for HTTP requests but it's unable to proceed my WebSocket requests to my application server. </p>
  
  <p>I don't know what I'm missing here .. If you guys can help me out would be great appriciate</p>