Redirect http to rancher in docker container

Hello everyone. I’m trying to redirect http queries through nginx to rancher server, that running in the docker container.
Here is my setup:
Docker:
Nginx container called “nginx”, eposed ports 80==>80/ 443==>443
Rancher server container, called “rancher” 8080==>8080
Nginx:
upstream rancher {
server 127.0.0.1:8080;
}
. . .

. . .
location /rancher {
proxy_pass http://rancher;
}

But when i testing this out in the browser, it’s not working. I’ve got just empty page with “Loading” in the header. In the console, i’ve seen that the webbrowser is searching site’s files in the wrong container (the nginx container, not rancher):

Why proxy_pass directive is’nt working? I’ve tryed to set different addresses in the “server” block of nginx configuration file, like: 127.0.0.1:8080/ 0.0.0.0:8080/ 192.168.13.132/8080. The result always is the same. Please help me.
Regards.

The UI is compiled to run from the root path and does not work when you add an extra prefix to it (/rancher).

Thank you for the reply.
I’m trying to implement athentication through https. Can u give me advice, how i can do it?

location / instead of location /rancher.

http://rancher.com/docs/rancher/v1.6/en/installing-rancher/installing-server/basic-ssl-config/#example-nginx-configuration

1 Like

It works. Thank you very much.

Excuse me, but now i have another problem:

Why rancher sending http requests, while connection established via http?

You didn’t look at the rest of the example in the documentation, which sets headers that allow the server to know the right url to return in responses, and the UI is just following what is returned.