title: Always 'proxy_pass' and require 'auth_basic' on requests started with '/admin'. How to write the nginx config?
body: <p>This is what I have. The problem is the proxy settings are duplicated. What's the better way to do it?</p>
  
  <pre><code>proxy_redirect off;
  
  location / {
    if (!-f $request_filename) {
      proxy_pass http://backend;
    }
  }
  
  location /admin {
    auth_basic 'Restricted';
    auth_basic_user_file passwd;
  
    if (!-f $request_filename) {
      proxy_pass http://backend;
    }
  }
  </code></pre>