Having Kibana Spaces behind their own Reverse Proxy

I am wondering if the following is possible to set up:

Have a vanity url for different spaces. Lets say we have two spaces defined 'foo' and 'bar' in Kibana. What I would like to do is have an url like foo.example.com which is proxied to kibana.example.com/s/foo and another one bar.example.com --> kibana.example.com/s/bar/

We are using nginx as our reverse proxy. I have tired the following config:

server {
    listen 80;
    server_name foo.example.com;
    
    location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_pass http://kibana.example.com:5601/s/foo/;
}

It ends up hanging with spinning Kibana Logo. It seems that it is trying to load the Space Chooser page and failing. Has anyone been able to get this to work?

Unless the user that accesses the URL has has access to only a single space out of the 2 of them , this won't work because Kibana will redirect on login to the root Kibana where it displays the space selector.
As far as I know, other than having unique users for this, there is no workaround.

I have a similar problem. Is there a way to remove the space selector page and let the user directly show the url being accessed.

e.g. if we redirect user directly to /s/foo/app/kibana, we are getting the space selector page. Instead I would like the user to see the Kibana dashboard directly.

Any inputs would be really helpful.

I think it is possible.
take dashboard - share - permalink

this link goes straight to user space without space selector. I tested this.
created foo space, created two dashboard and got a link. close all browser and open again past that link and it went to dashboard page directly

http://localhost:5601/s/foo-space/app/kibana#/

this link goes to kibana space foo-space

@elasticforme your suggestion does not work for reverse proxy situation. It works if you plan on sending people the link to the space so they can access it. But you can’t use that link as the base for a reverse proxy.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.