Basic http auth with proxy pass showing 403/Forbidden

strom nginx-forum at
Thu Sep 16 04:17:04 MSD 2010

I am simply trying to password protect a folder and a file in my webapp
with basic_auth, but I'm running into some problems.

Here's the relevant conf info:

          location / {
            proxy_redirect      off;

            proxy_set_header    Host    $http_host;
            proxy_set_header    X-Real-IP    $remote_addr;
            proxy_set_header    X-Forwarded-For    

            proxy_read_timeout  700;

           location ~ /(admin/.*|test) {
            auth_basic            "Restricted";
            auth_basic_user_file  conf/htpasswd;
            proxy_pass; # tried both with
and without this line

I essentially want to protect my admin directory along with the test
page, but when I have this location module, I am getting 403 forbidden
on my webapp for the admin directory and test page.


Posted at Nginx Forum:,130796,130796#msg-130796

More information about the nginx mailing list