Welcome! Log In Create A New Profile

Advanced

NGINX frontending Kibana not working with “_plugin/kibana/” URL

Posted by gjws 
NGINX frontending Kibana not working with “_plugin/kibana/” URL
May 22, 2017 04:00PM
I'm running the AWS Managed ElasticSearch to collect some logs and have created some Kibana dashboards to visualise the data, all that works fine.

Unfortunately the Kibana plugin included on with the AWS cluster is pretty much open to the world, so I have setup an NGINX reverse proxy to provide authenticated access. This is also working fine if I simply hit the domain URL and specify the full URI to the Kibana plugin. For example:

http://nginx.domain.com/_plugin/kibana/app/kibana works just fine, here in the nginx configuration I am using to achieve that:

worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header User-Agent $http_user_agent;
auth_basic_user_file /etc/nginx/.htpasswd;
auth_basic "Auth Required";
proxy_pass https://search-mystuff.ap-southeast-2.es.amazonaws.com/;
proxy_redirect https://search-mystuff.ap-southeast-2.es.amazonaws.com/ /;
proxy_set_header Authorization "";
proxy_hide_header Authorization;
}
}
}

Rather than providing the full URL, I would like to simply hit the base domain name of the NGINX server, which would then redirect me to the full Kibana URI. So what I would LIKE to do is this:

http://nginx.domain.com

After entering the above URL, I would like to be redirected to the full Kibana URI, so I would end up with a URL like this

http://nginx.domain.com/_plugin/kibana/app/kibana

Here is the nginx configuration I have tried (in various different permutations) that does not work:

worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header User-Agent $http_user_agent;
auth_basic_user_file /etc/nginx/.htpasswd;
auth_basic "Auth Required";
proxy_pass https://search-mystuff.ap-southeast-2.es.amazonaws.com/_plugin/kibana/app/kibana;
proxy_redirect https://search-mystuff.ap-southeast-2.es.amazonaws.com/_plugin/kibana/app/kibana /;
proxy_set_header Authorization "";
proxy_hide_header Authorization;
}
}
}

With the configuration above, when I browse to http://nginx.mydomain.com the URL is redirected to:

http://nginx.myaws.com.au/_plugin/kibana/app/kibana
This looks like it SHOULD work, however I receive an error in the browser window:

{"statusCode":404,"error":"Not Found"}

I have about 4 hours experience with nginx, so hopefully I'm missing something simple.

Any help would be very much appreciated, thank you!
Re: NGINX frontending Kibana not working with “_plugin/kibana/” URL
November 09, 2022 10:15AM
Hi,

few years later I have found a great post with a really nice solution for this: https://boringtechnology1.github.io/jekyll/update/2022/11/05/secured-kibana-dashboard-with-angular-and-spring-boot.html

It is about connecting Spring Boot, Angular and Kibana with nginx server. It works also with newer versions of Kibana.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 203
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready