title: Nginx consumes Upgrade header after proxy_pass
body: <p>So I have been banging my head against the wall for the better part of 2 days, please help.</p>
  
  <p>I am attempting to establish a Websocket connection using this
  <a href="http://django-websocket-redis.readthedocs.org/en/latest/running.html#django-with-websockets-for-redis-behind-nginx-using-uwsgi">django-websocket-redis</a> configuration.
  There are 2 instances of uwsgi running, one for the website and one for the websocket communication.</p>
  
  <p>I used wireshark  heavily to find out what exactly is happening, and apparently nginx is eating the headers "Connection: Upgrade" and "Upgrade: websocket".</p>
  
  <p>here is the critical nginx config part:</p>
  
  <pre><code>upstream websocket {
      server 127.0.0.1:9868;
  }
  
  location /ws/ {
      proxy_pass_request_headers      on;
      access_log off;
      proxy_http_version 1.1;
      proxy_pass http://websocket;
      proxy_set_header Connection "Upgrade";
      proxy_set_header Upgrade websocket;
  }
  </code></pre>
  
  <p>As you can see on those 2 <a href="http://imgur.com/HPrtFCW&amp;PtJbJ14">screenshots</a>, tcpdump of internal communication shows that the handshake works nicely. but in my browser (second image) the headers are missing.</p>
  
  <p>Any ideas are greatly appreciated. I am truly stuck here :(</p>
  
  <p>Versions: </p>
  
  <pre><code>nginx - 1.7.4
  uwsgi - 2.0.7
  </code></pre>
  
  <p>pip freeze:
      Django==1.7
      MySQL-python==1.2.5
      django-redis-sessions==0.4.0
      django-websocket-redis==0.4.2
      gevent==1.0.1
      greenlet==0.4.4
      redis==2.10.3
      six==1.8.0
      uWSGI==2.0.7
      wsgiref==0.1.2</p>