Config setting for UI base path?

webconsole

#1

We are using nginx to reverse proxy services and need to setup the couchbase UI to be served off a non-root path (ie /couchbase). I can pull up the login page, but it looks like the JS POSTS to the root no matter what. Is there an option somewhere to configure this?


#2

Hi @chief

First off, Couchbase UI sessions are “sticky” to the server you log into. So you’ll need to configure the reverse proxy to forward to one node and they stick to it for the remainder of the UI session (until the user logs out.) Clustered sessions are a nice-to-have for folks, but most of our users have a small number of admins logging it and so it’s not really needed. This may address your issue: you get the login page, but since subsequent requests go to other nodes where the user is not logged in, it doesn’t work. If this doesn’t answer your question (i.e. you’re already implementing sticky sessions) then it may be the case that this is an nginx configuration question.

-dave


#3

@davef thanks, that may solve the issue, I will post back here once I change the nginx config.


#4

@davef

Ok, so I dug a little into this, and found that the POST to /uilogin is hard-coded in a client-side javascript file, because of this we cannot use couchbase UI behind a proxy that’s not using the root. In my example, we are serving off of http://proxy.service.consul/couchbase-ui/index.html

Here’s the code in ns_server


#5

Hi @chief

Thanks for following up and posting your analysis. Yes, you are right of course we post against the root resource of the URL for REST API requests (for things like logging in, configuring and getting server side data, etc); web resources (JS, CSS and HTML files) we request via relative URLs. This is because the the UI resources are a closed system with respect to themselves which then access REST URLs absolutely. I guess there’s no way you can configure Couchbase against the root part of the URL? :slight_smile:

We can certainly consider being more web proxy friendly in the future and I filed a ticket here to track that improvement: https://issues.couchbase.com/browse/MB-19959.

-dave


#6

I encountered exactly the same problem @chief described in this thread.
I have five Couchbase servers, what I wanted is to put all of them behind one reverse proxy server couchbase.example.com and access their web consoles with different paths:

I managed to load login forms from different hosts but could not login because of hard-ceded POSTs to /uilogin.

Would be great if you could fix that.