title: Nginx logical AND operator
body: <p>How do you write an Nginx rule to redirect all non-https requests to https, except for a certain path?</p>
  
  <p>I have a health-check path that's not under SSL, but I want everything else to be redirected to SSL, so I need a rule like:</p>
  
  <pre><code>if ($http_x_forwarded_proto != 'https' &amp;&amp; $request_uri != "/check.html") {
      return 301 https://$host$request_uri;
  }
  </code></pre>
  
  <p>but that gives me a syntax error. Google shows several examples for doing logical OR expressions, but nothing for AND. Is this supported in Nginx?</p>
  
  <p>Edit: This server sits behind a load balancer, and all requests are forwarded on port 80, even if the original request is https. I also need this redirect to work with a uwsgi application configured like:</p>
  
  <pre><code>location / {   
      uwsgi_pass  unix:///tmp/myapp.sock;
      include     /usr/local/myapp/uwsgi_params;
  }
  </code></pre>