title: NGinx : How to test if a cookie is set or not without using 'if'?
body: <p>I am using the following configuration for NGinx currently to test my app :   </p>
  
  <pre><code>location / {
              # see if the 'id' cookie is set, if yes, pass to that server.           
              if ($cookie_id){
                  proxy_pass http://${cookie_id}/$request_uri;                
                  break;
              }
  
              # if the cookie isn't set, then send him to somewhere else
              proxy_pass http://localhost:99/index.php/setUserCookie;
          }
  </code></pre>
  
  <p>But they say "<a href="http://wiki.nginx.org/IfIsEvil" rel="noreferrer">IFisEvil</a>". Can anyone show me a way how to do the same job without using "if"?<br>
  And also, is my usage of "if" is buggy?</p>