Issue with NGINX as reverse proxy with basic auth in front of Apache with basic auth

Brane F. Gračnar brane.gracnar at najdi.si
Wed Aug 31 10:48:44 UTC 2011


On Wednesday 31 of August 2011 12:07:27 ssaravalli wrote:
> Hello to everybody, my name is Simone Saravalli and I'm new to NGINX
> world.
> 
> This is my problem: I set up NGINX as a reverse proxy to a backend
> server with Apache. On NGINX side I configured basic authentication for
> / location:
> 
>       location / {
>           auth_basic             "Restricted";
>           auth_basic_user_file   /etc/nginx/htpasswd;
>           proxy_pass             http://xxx.xxx.xxx.xxx;
>           proxy_redirect         off;
>           proxy_set_header       Authorization "";
>           proxy_set_header       Host $host;
>           proxy_set_header       X-Real-IP $remote_addr;
>           proxy_set_header       X-Forwarded-For
> $proxy_add_x_forwarded_for;
>           proxy_set_header       X-Forwarded-Ssl on;
>       }

You're removing Authorization request header before sending request to Apache 
server. That's why Apache cannot authenticate user.

Comment-out the following line and try again:

proxy_set_header       Authorization "";

Best regards, Brane



More information about the nginx mailing list