title: nginx auth_basic "Restricted" prompting login on every request
body: <p>I've set up a simple nginx server, configured the location block to point to the respective directories I want served, and setup basic authentication using the auth_basic module.</p>
  
  <p>However, <strong><em>my server requests username : password credentials on every single page request under the location block</em></strong>, even after providing them multiple times to different pages under the location block, including the root location directory.</p>
  
  <p>How can I configure it to store the authentication? Is this an nginx issue or a browser / request headers issue?</p>
  
  <p>Here is the nginx configuration:</p>
  
  <pre><code>server {
      listen 80;
      server_name 0.0.0.0;
  
      location /path/to/dir {
          alias /var/www/dir/;
          index   index.html index.htm;
          auth_basic "Restricted";
          auth_basic_user_file /etc/nginx/.htpasswd;
          try_files $uri $uri/ =404;
      }
  }
  </code></pre>
  
  <p>Running nginx 1.4.6 on Ubuntu.</p>