Basic HTTP auth prompting too many times

E.B. emailbuilder88 at
Wed Apr 8 06:18:28 UTC 2015

>  After some time, browsers begin to prompt for authentication
>  over
>  and over again (I guess once for every image, stylesheet,
>  script, etc?).
>  Or maybe it is prompting because the credentials failed, but
>  I don't
>  think so because if I hit cancel/ESC over and over again, I
>  can use
>  the web page (I'm still authenticated), but none of the
>  images or
>  scripts have loaded.

Oh, I think this is caused by misunderstnad how locations
working. I had:

location ~* \.php$ {...PHP settings...}
location /admin {...HTTP AUTH settings...}

After reading about locations now I understand that ONLY ONE gets used.
Which means PHP was working fine but HTTP AUTH was only protecting
the non-PHP files in /admin! Am I correct?

So problem in this case is caused by when browser forgets auth credentials
but PHP files not protected so it displayed the cached PHP file OK but all
the images and script files cause prompt for auth. Many prompts over and

More information about the nginx mailing list