title: Nginx/Load balancer coniguration for
body: <p>I am trying to configure out load balancer to enable http(s) and web-socket connections.</p>
  
  <p>Using this blog
  <a href="http://blog.flux7.com/web-apps-websockets-with-aws-elastic-load-balancing" rel="nofollow noreferrer">http://blog.flux7.com/web-apps-websockets-with-aws-elastic-load-balancing</a></p>
  
  <p>and following configuration but with SSL certificates.</p>
  
  <p><a href="https://i.stack.imgur.com/IiSCP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IiSCP.png" alt="ELB Configuration"></a></p>
  
  <p>The only problem is we have a configuration in Nginx which redirects http requests to https, which has stopped working as X-forwarded-proto is not supported by Load Balancer anymore.</p>
  
  <pre><code>if ($http_x_forwarded_proto = "http") {
    return 301 https://www-stg.example.com/$request_uri;
  }
  </code></pre>
  
  <p>Any help on how this can be resolved?</p>
  
  <p>Thanks</p>