3

I would like to run datastax cassandra opscenter behind Nginx. But it keeps adding opscenter port (8888 by default) to all urls. Is there a config setting to disable that or something?

Here is my super simple nginx config:

server {
  server_name opscenter.hostname.com;

  location / {
    proxy_pass http://127.0.0.1:8888;
  }
}

Is there something I'm doing wrong maybe?

gansbrest
  • 785
  • 1
  • 8
  • 17
  • Hm, it seems like I can access it through /opscenter url, but if I go to / (root) opscenter will issue 302 redirect to host:8888/opscenter/index.html.. Is there a way to drop 8888 port? – gansbrest Oct 28 '13 at 21:28
  • 1
    How did you handle the tcp streaming proxy to /tcp? Did you enable 1.1? – GregB Dec 13 '13 at 17:32

3 Answers3

2

Solved this by adding nginx redirect to /opscenter

location = / {
  rewrite (.*) /opscenter;
}
gansbrest
  • 785
  • 1
  • 8
  • 17
  • the other important piece that needs to be in nginx config is proxy_buffering off http://serverfault.com/questions/549553/0-connected-nodes-in-datastax-opscenter – gansbrest Oct 30 '13 at 16:30
1

You need to create location like the following:

location / {
    proxy_pass http://127.0.0.1:8888;
    proxy_redirect http://localhost:8888/ /;
    proxy_redirect http://your.host.name:8888/ /;
    proxy_buffering off; 

}

The proxy_redirect lines will strip the 8888 from the responses returned by OpsCenter.

More info on what proxy_redirect does can be found at http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

timurb
  • 347
  • 3
  • 12
1

I tried the suggested configurations and more, but none of them worked for me.
Here is my use case, and my solution.

My servers

Nginx and OpsCenter are both on 2 different machines. Unlike Nginx, OpsCenter is not accessible directly from the internet.

Nginx 1.4.6 is on 172.132.1.2 (public network)
OpsCenter 5.2.0 is on 172.132.2.3 (private network)

Nginx Configuration

upstream opscenter {
  server 172.132.2.3:8888;
}

server {
    listen 81 default_server;
    listen [::]:81 default_server ipv6only=on;

    location / {
         proxy_pass http://opscenter;
         proxy_redirect http://$proxy_host:8888/ http://$host:$server_port/;
         proxy_buffering off;
    }

    location ~ /\.ht {
        deny all;
    }
}
Micka
  • 121
  • 5