# Redirect http to rancher in docker container

**URL:** <https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897>\
**Category:** Rancher 1.x\
**Created:** [July 19, 2017, 8:56am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897 "2017-07-19T08:56:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artemich](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Artemich](https://forums.suse.com/u/Artemich)\
**Post date:** [July 19, 2017, 8:56am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/1 "2017-07-19T08:56:40Z")

</div>

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](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):

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/e/ee62b2995075d2f9d75ce6fd0cdbf7357cb0ba4e.jpg)

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.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 19, 2017, 9:10am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/2 "2017-07-19T09:10:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Artemich](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Artemich](https://forums.suse.com/u/Artemich)\
**Post date:** [July 19, 2017, 9:51am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/3 "2017-07-19T09:51:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 19, 2017, 10:09am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/4 "2017-07-19T10:09:01Z")

</div>

`location /` instead of `location /rancher`.

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

---

<div class="post-metadata">

**Author:** ![Artemich](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Artemich](https://forums.suse.com/u/Artemich)\
**Post date:** [July 19, 2017, 10:41am UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/5 "2017-07-19T10:41:24Z")

</div>

It works. Thank you very much.

---

<div class="post-metadata">

**Author:** ![Artemich](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Artemich](https://forums.suse.com/u/Artemich)\
**Post date:** [July 19, 2017, 1:15pm UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/6 "2017-07-19T13:15:22Z")

</div>

Excuse me, but now i have another problem:

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/2/2a00cd5c8e1c48c66328b1e78fe261db7ec2c76d.jpg)

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

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [July 19, 2017, 4:22pm UTC](https://forums.suse.com/t/redirect-http-to-rancher-in-docker-container/6897/7 "2017-07-19T16:22:53Z")

</div>

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.
