Answer the question
In order to leave comments, you need to log in
Why does the http authorization window appear twice?
Good afternoon!
LAMP stack, site with http authorization configured via .htaccess
AuthType Basic
AuthName 'Restricted Area'
AuthUserFile {$path}/.htpasswd
Require valid-user
view-source:{$url}
, the authorization window appears again, if it is rejected, there will be a 401 code. Also periodically (~ 1 time in 20 minutes an authorization request appears when loading normal pages). {ip} - developer [09/Mar/2021:16:00:55 +0100] "GET /blog-posts/ HTTP/1.1" 200 27612 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"
{ip} - - [09/Mar/2021:16:01:21 +0100] "GET /blog-posts/ HTTP/1.1" 401 4361 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.{$domain} [OR]
RewriteCond %{SERVER_NAME} ={$domain}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Answer the question
In order to leave comments, you need to log in
Are you accessing over HTTP or HTTPS?
I have not worked with auth in Apache for a long time, but the redirect seems to me the only possible cause of this problem.
Here https://stackoverflow.com/questions/30947859/htacc... advice that seems reasonable to me.
Perhaps some resource is connected via http?
Try to move the rule with the http→https redirect above the authorization. So that authorization is requested only for https, and the redirect occurs without it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question