Welcome! Log In Create A New Profile

Advanced

auth_basic with proxy_pass problem

Posted by macgor 
auth_basic with proxy_pass problem
April 08, 2016 06:47PM
Hello,

I have strange behavior when I try to use auth_basic with proxy_pass.

Basically need to do auth_basic by Nginx and if it is passed proxy_pass to RabbitMQ management console.

Browser is asking for credentials on every request, every file js, css, png etc.... when I pass valid data, single resource is downloaded.

Is there any way so it asks first time and then remembers it?

My config looks like:

upstream rabbitmq {
server 127.0.0.1:15672;
}

server {
server_name rabbitmq.example.com;
location / {
auth_basic "restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
proxy_read_timeout 600;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://rabbitmq/;
}
}

Thanks for help,

Maciej
Re: auth_basic with proxy_pass problem
April 09, 2016 01:50AM
Try
proxy_pass http://rabbitmq;

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: auth_basic with proxy_pass problem
April 09, 2016 04:16PM
Thanks, but already tried this. Still no result...
Re: auth_basic with proxy_pass problem
April 09, 2016 06:34PM
Then you must have another location block where authentication isn't used or the backend is also still expecting authentication.
Check the logfiles, nginx and backend.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 157
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready