title: NGINX not equal to
body: <p>A client wants me to block access to a page unless the http_user_agent = xxx.</p>
  
  <p>Is there a way to do this? I was thinking of an <code>if else</code> or <code>if not</code> function but this doesn't seem to exist.</p>
  
  <p>If I wanted to block a user agent I could do the below but is there a way to only allow that user agent?</p>
  
  <pre><code>if ($http_user_agent ~* (xxx) ) {
     return 403; 
  }
  </code></pre>