title: nginx websocket reverse proxy configuration
body: <p>Hi I am trying to configure nginx as reverse proxy for websockets. I configure my server as following:</p>
  
  <pre><code>server {
      listen       80;
      server_name  www.mydomain.com;
  
      access_log  off;
      #error_log off;
  
      location / {
          proxy_pass         http://127.0.0.1:8765;
          proxy_redirect     off;
  
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
          proxy_set_header Host $http_host;
  
          proxy_buffering off;
      }
  
  }
  </code></pre>
  
  <p>but I get an error from client like following</p>
  
  <p>WebSocket connection to 'ws://www.application.com/ws' failed: Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'</p>
  
  <p>I am probably doing some configuration wrong but I could not see it.</p>
  
  <p>Request headers for client is following</p>
  
  <pre><code>GET ws://www.talkybee.com/ws HTTP/1.1
  Pragma: no-cache
  Origin: http://www.talkybee.com
  Host: www.talkybee.com
  Sec-WebSocket-Key: Ol+O1IdaLEsHxxWRBt2oqg==
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
  Upgrade: websocket
  Sec-WebSocket-Extensions: x-webkit-deflate-frame
  Cache-Control: no-cache
  Connection: Upgrade
  Sec-WebSocket-Version: 13
  </code></pre>
  
  <p>When I do a normal direct connection, My connection just works. Here is the working request header.</p>
  
  <pre><code>Cache-Control:no-cache
  Connection:Upgrade
  Host:www.talkybee.com:8765
  Origin:http://www.talkybee.com:8765
  Pragma:no-cache
  Sec-WebSocket-Extensions:x-webkit-deflate-frame
  Sec-WebSocket-Key:Y026b/84aUkMxVb0MaKE2A==
  Sec-WebSocket-Version:13
  Upgrade:websocket
  User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
  </code></pre>