I have dockerized microservices application with nginx container as reverse proxy. Since I want nginx to be aware of changes in containers I've added resolver 127.0.0.11 valid=30s;
to http directive and started using variables in locations with proxy_pass. Now another problem that arised was passing uri to the proxy pass - from what I've learned adding $request_uri should solve the problem, but instead it just made the whole location stop to work and throw 404. After lots of tries I'm lost and hope to find answer here.
My current location directive looks like this:
location /service-dashboard/ {
auth_basic "Administrator’s Area";
auth_basic_user_file /etc/apache2/.htpasswd;
include /etc/nginx/proxy-options/proxy.conf;
set $dashboard http://dashboard;
proxy_pass $dashboard$request_uri;
proxy_redirect off;
}
I've tried also adding it in the set directive as well as $uri$is_args$args;
, with or without slash before but all of these ended up with 502 or 404. What am I doing wrong? Just to be clear - everything works just fine if I do proxy_pass http://dashboard/
, but that's a no go if I want resolver to work properly.