Nginx – how to protect a website in elastic beanstalk docker nginx using password

.htaccessdockerelastic-beanstalknginx

I've a django web application hosted in AWS Elastic Beanstalk with Docker and Nginx. I am using supervisor to start nginx and uwsgi. Need to protect it the website using password. I've tried using .htaccess.

htpasswd -cb /etc/nginx/.htpasswd admin admin 

and added the nginx config with

location / {
  auth_basic "Restricted";
  auth_basic_user_file  /etc/nginx/.htpasswd;
  uwsgi_pass unix:/var/sockets/api.sock;
  include    /home/docker/uwsgi_params; 
}

It's working but its asking password repeatedly. Usually htaccess only asks password once in session. But it asks for username and password every time we click one field or button. Is there any way to fix it?

Best Answer

Hi all the issue was same as in the following question . It seems they have a solution for it.

https://stackoverflow.com/questions/36057631/nginx-password-authentication-keeps-prompting-for-password

Related Topic