Nginx basic auth working on http but not on https
<p>Im running nginx on centos 6. The domain is configured to use ssl. Some specific folders need to be password protected. If I type the url with http the basic the browsers asks to enter user and pass. If I type the same url with https then the index file of the specific folder will be shown without asking for user pass. </p>

<p>I have this in my domain specific nginx.conf file:</p>

<pre><code>  location /protected_folder {
      auth_basic "Restricted";
      auth_basic_user_file /etc/nginx/.htpasswd;
  }
</code></pre>

<p>How can I make sure that the both urls using http and https are password protected?</p>