How to Update Kibana Dashboard URL from /app/kibana to /kibana/app/kibana

Hi,

We are having an issue while accessing Kibana Dashboard through Nginx reverse proxy.

When we add Location block "/" in Nginx.conf for kibana then we are able to access kibana dashboard through "root", in the backend its making all these calls.

/api
/app
/bundles
/elasticsearch
/kibana
/plugins
/ui

Kibana accessible only if we have just "/" in location block but it's not propery way to access kibana dashboard on Nginx proxy as a root.
so when we added location block seprately for each call, "/api, /app, /bundles, /kibana, /plugins, /ui, /elasticsearch....etc", then again it works, this is going to be big mess adding buch of location blocks in nginx.conf

Example:
Nginx.conf

    location / {

        proxy_http_version 1.1;
        proxy_set_header Connection "";

        set $proxy_pass http://<kibana url>:5601;
        proxy_pass http://<kibana url>:5601;

        proxy_intercept_errors on;
    }

Is there a way we can update Dashboard access instead of / to /kibana into kibana configuration so that we can add only one location block /kibana in Nginx.conf so that in the backend it will make all the calls adding /kibana in prefix?

/kibana/api
/kibana/app/kibana
/kibana/bundles
/kibana/elasticsearch
/kibana/kibana
/kibana/plugins
/kibana/ui

Please suggest me what will the recomended way to access kibana Dashboard through Nginx reverse proxy, Thanks.

You can place this in your kibana.yml:
server.basePath: /kibana
It will do what you are looking for I think. Then you can configure a /kibana block in your nginx config.

I have added server.basePath: /kibana variable into kibana.yml and restarted kibana service

also added location block in nginx with /kibana, when i hit nginx Proxy URL am not able to access dashboard and i see below log into nginx error.log file.

Below log is generating only when i hit directly nginx proxy URL without /kibana, if i add /kibana along with URL it's not logging anything in Nginx, attached screenshot of inspect section.

2019/01/10 20:36:52 [error] 17407#17407: *6711673 "/root/index.html" is forbidden (13: Permission denied)

Nginx Location block:

    location /kibana {

        
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        set $proxy_pass http://<kibana url>:5601;
        proxy_pass http://<kibana url>::5601;

        proxy_intercept_errors on;
        proxy_redirect off;
    }

Not an nginx expert, but I think your proxy_pass directive is missing /kibana.

seems to be working with below location block, thanks for your help.

    location /kibana {

        rewrite ^/kibana/?(.*)$ /$1 break;
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        set $proxy_pass http://<kibana url>:5601;
        proxy_pass http://<kibana url>:5601;

        proxy_intercept_errors on;
        proxy_redirect off;
    }
1 Like

Great, and thanks for posting your solution so someone else can learn from your experience.

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