Can someone share nginx config for reverse proxying Kibana4.4/4,5

Hi,

I am struggling to make reverse proxy work with latest versions of Kibana Kibana4.4 /Kibana 4.5

This is my current setting of nginx.
My config for basepath is -

server.basepath : "/analytics"

I want to redirect all request for /analytics to kibana server. but all I am getting is 404.Please help me with some example config if anyone has done it earlier.

server {
    listen 80;

    server_name ubuntuS1;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
        proxy_pass http://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
      }
}

That's what I use and works just fine.

@brayndasilva this used to work for 4.1 but ever since Kibana has moved to "/app/kibana" from "/" this has stopped working for me.Which version you are using ?I am trying to upgrade from 4,1 to 4.4/4.5

I'm using Kibana 4.4.2

Are you using the server.basepath config?

I'm having the same problem with kibana 4.5 and even though @brayndasilva 's solution works, it ONLY works when you use kibana in the root path ('/').

If you want a different path (i.e. setting server.basepath) it won't work.

For my use case I can't point it to root('/'). So, I tried working with the server.basepath config. But seems like I am unable to make it work or the feature itself is broken.

here:

location ~ /analytics/(?<kibana_uri>.*) {
   proxy_pass http://127.0.0.1:5601/$kibana_uri;
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection 'upgrade';
   proxy_set_header Host $host;
   proxy_cache_bypass $http_upgrade;
}
# optional block to handle landing url without trailing slash: `/analytics`
location = /analytics {
   return 302 /analytics/;
}

This captures the part after /analytics/ to a $kibana_uri variable, which is then used to set the proxy_pass destination.

This was tested for Kibana 5.2 too.

2 Likes

Hi Vladimir_Aleksandrov
I have similar issue I have to access the kibana kibana version 5.1.1 through Nginx .But all I get is 404 not found error
If I access the URL like this http://localhost:8070/Analytics
It should go to this URL path http://localhost:5601/_plugin/kibana

Please give me an example config...