Why I can not change Couchbase Web Console Port to '80'?

hi,

why I can not change Couchbase Web Console Port to ‘80’?

[root@c3-trelay02 bin]# ./couchbase-cli cluster-init -c localhost:8091 -u admin -p password --cluster-init-port=80
ERROR: unable to init/modify localhost (400) Bad Request
[u'The port number must be greater than 1023 and less than 65536.']

In my IDC, only the port 80 is used for developer on pc.
Is there a way to use port ‘80’

Thanks!

Are you going to only use that to access couchbase console? If so, you can just run reverse proxy there. Otherwise changing just this port will not make whole couchbase server available, because you have to make all these port accessible http://docs.couchbase.com/admin/admin/Install/install-networkPorts.html.

This is an example of config for nginx reverse proxy:

upstream couchbase {
    server localhost:8091;
}

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

    location / {
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-Proto $scheme;
        proxy_set_header  Host $http_host;
        proxy_pass        http://couchbase;
    }
}

With this config, you can access console on http://console.example.com

Thanks

I use nginx to proxy. but it has other error when all post request:

10.237.110.61 - - [18/Nov/2014:20:59:23 +0800] "POST /controller/startGracefulFailover HTTP/1.0" 401 0 http://10.105.10.85/index.html Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36

my nginx config is :

server {
    listen       80;
    server_name  localhost;

    location / {
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded- Proto $scheme;
        proxy_set_header  Host $http_host;
        proxy_pass        http://localhost:8091;
    }
}

Sorry, I forgot to mention that authentication headers should be also passed to backend

proxy_set_header  Authorization $http_authorization;
proxy_pass_header Authorization;

But again, other nodes need an access to all ports of the server to be able to replicate data and perform other actions

Thanks, avsej!

It’s work on the nginx-1.5.8 and install headers-more-nginx-module

more_set_input_headers ‘Authorization: $http_authorization’;
more_set_headers -s 401 ‘WWW-Authenticate: Basic realm=“your.mail.host”’;

Sorry to dig up an old thread. I, too, am having problems getting similar 401 related errors.

Here is my relevant nginx config block.

upstream dbhost {
    server db-live.domain.com:8091;
}

server {
    server_name dbadmin.domain.com;
    listen 443 ssl;
    include lvlr/ssl_domain.conf;  // for our wildcard domain ssl
    index index.html;
    location / {
            index index.html;
            rewrite ^/$ /index.html break;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header  X-Forwarded-Proto $scheme;
            proxy_set_header  Host $http_host;
            proxy_set_header  Authorization $http_authorization;
            proxy_pass_header Authorization;
            proxy_pass_header       Accept;
            proxy_pass_header       Server;
            proxy_pass         http://dbhost;
    }

}

I am seeing a similar error.

[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized) (resetAlerts, line 0)   https://dbadmin.domain.com/controller/resetAlerts?token=2&uuid=[redacted]

Basically, GET requests seem fine but POSTs fail?

I’m sure it’s something simple I’m missing, but this is driving me nuts. Thanks.

I FIGURED IT OUT.

The secret sauce is that the ns_server-ui header is required.

To the location stanza, add the following line:

proxy_set_header ns_server-ui yes;

Sorry to keep reviving this, but after further usage and experimentation, I found the following to be more robust.

In the server stanza:

ignore_invalid_headers off;

And in the location stanza for reverse proxy:

proxy_pass_request_headers on;

So far, this seems to work flawlessly with no errors.