1
I want to set up an environment where I would have a simple implication that will be accessible through a forward proxy using for both the proxy and the app nginx.
Both of my nginx are docker containers.
First this is the nginx.cong of the application
events { }
http {
server {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
root /doc;
location / {
}
}
}
It is working fine with the user:password that I set up. I am able to access it doing a simple curl command
curl -u user:password http://172.18.0.1:8184/test.csv
Now, I set up the proxy using this configuration
events { }
http {
server {
auth_basic "BLABLABLA";
auth_basic_user_file /etc/nginx/.htpasswd;
listen 8185;
location / {
proxy_pass http://$http_host$uri$is_args$args;
proxy_pass_request_headers on;
}
}
}
I try to access the first app again using this proxy doing this command
curl -x 127.0.0.1:8185 -U user_proxy:password_proxy -u user:password http://172.18.0.1:8184/test.csv
But it return 401.
In the log I see that the proxy is reading user:password of the app and not the one provided as user_proxy:password_proxy.
I don't find how to set up the proxy to use correctly the right user:password as Authentication.
Thanks in advance.