Welcome! Log In Create A New Profile

Advanced

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

August 31, 2011 06:07AM
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;
}

In this way, when a user goes to http://192.168.0.10 (say the ip of the NGINX reverse proxy), he's prompted for username/password and then redirected to http://xxx.xxx.xxx.xxx as expected.

The problem: if on Apache I set another step of authentication (basic auth, LDAP) something goes wrong. From NGINX's logs I see when I sent username/password for Apache. From Apache's logs I cannot see anything. Obviously I got an error because NGINX doesn't know these username/password because they are for Apache.

How can I solve this problem?

Thanks in advance for any reply. Regards.
Subject Author Posted

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

ssaravalli August 31, 2011 06:07AM

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

Brane F. Gračnar August 31, 2011 06:48AM

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

ssaravalli August 31, 2011 07:15AM

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

Igor Sysoev August 31, 2011 08:28AM

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

ssaravalli September 01, 2011 10:19AM

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

Maxim Dounin September 01, 2011 10:52AM

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

ssaravalli September 02, 2011 02:09AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready