Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access the rancher server through proxy failed, because rancher server redirect to intranet IP #1153

Closed
hjianhao opened this issue Jun 11, 2015 · 15 comments
Labels
kind/question Issues that just require an answer. No code change needd

Comments

@hjianhao
Copy link

I access the rancher from internet with mydomainname:port (for example 91)
rancher server running on IP 192.168.1.140 (intranet IP)
I am using nginx for proxy, pass the request from port 91 to IP 192.168.1.140:8080

I enter the mydomainname:91 url on browsers, then redirect to 192.168.1.140:8080/static, so this intranet IP can not be accessed from internet.
I think rancher server should not redirect the request to intranet IP and ports.

@deniseschannon deniseschannon added the kind/question Issues that just require an answer. No code change needd label Jun 12, 2015
@ka2er
Copy link

ka2er commented Jun 15, 2015

+1 definitively need reverse proxy support

@hjianhao
Copy link
Author

I do configure a reverse proxy using nginx ( using proxy_pass), but still redirect to intranet IP?

@hjianhao
Copy link
Author

When I access the rancher server, When load the homepage, I found the request projects?all=true, request URL is intranet.

issue

@cloudnautique
Copy link
Contributor

How do you have the Nginx proxy configured?
Rancher should obey Host header and X-Forwarded-For.
You will also need a location /v1/subscribe block that handles proxying websocket requests.

@vincent99
Copy link
Contributor

/v1/stats needs WebSockets too.. It would be better to make the whole proxy able to handle them rather than certain URLs that currently need it.

@cloudnautique
Copy link
Contributor

I think if just the proxy_pass setting is used, then the request is made with the host header of the proxy_pass server.

A basic setup that should work, and handle the websockets:

 upstream rancher {
     server rancher1:8080
 }

 server {
     listen 80; 
     server_name rancher.example.com;

       location / {
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://rancher;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
    }

 }

@hjianhao
Copy link
Author

@cloudnautique thanks for your reference configuration, it did work.
But there is a little problem, I can not use the 80 port (for conflict reason), so It failed firstly, I change the the proxy_set_header Host $host; to proxy_set_header Host $host:$port; it did work.
thanks again. :)

@deniseschannon
Copy link

@hjianhao Since it looks like we've fixed this issue, I'll close it.

@flaccid
Copy link

flaccid commented Jun 17, 2015

@cloudnautique Thanks for the nginx conf, this worked for me however it ends up redirecting to the public IP after login e.g. http://1.2.3.4:8080/static/services/projects instead of http://foo.com/static/services/projects. Something I am missing?

@cloudnautique
Copy link
Contributor

Was the github callback setup with the ip?

@flaccid
Copy link

flaccid commented Jun 18, 2015

@cloudnautique yes - do you recommend disabling access control and re-set it up to solve?

@vincent99
Copy link
Contributor

Yes; GitHub always sends you back to the URL configured in the application you create.

@flaccid
Copy link

flaccid commented Jun 18, 2015

Ok, I tried but now its stuck in some weird state always going to Error and so i went to the settings/auth URL manually and tried to auth but the whole page didn't load and now all URLs are stuck on:

Error
GitHubError (503)
Non-200 Response from Github
Reload to try again or log out

@flaccid
Copy link

flaccid commented Jun 18, 2015

Ok, so I have fixed that up by upgrading but when accessing with the reverse proxy (and I also employed https forcing), I get:

[Exception... "<no message>" nsresult: "0x805e0006 (<unknown>)" location: "JS frame :: https://releases.rancher.com/ui/0.28.0/assets/vendor.js :: .send :: line 3" data: no]

I actually use a separete nginx container to redirect all http requests to https, the https then terminates with an ELB which then forwards to the nginx conf above.

@winggundamth
Copy link

@flaccid I still looking for correct nginx configuration https reverse proxy too. I put the detail here #1151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Issues that just require an answer. No code change needd
Projects
None yet
Development

No branches or pull requests

7 participants