Kibana authentication using X-pack fails when running behind nginx proxy

I am using nginx to serve as a proxy for my kibana. But kibana is unable to communicate with elasticsearch when accessing through nginx. This issue occurs only using Xpack for authentication.

For example if kibana is running at 10.10.10.10:5601, I can access it using this address directy and everything works just fine.

Now I want to map search.mysite.com to this ip using nginx. In this case, I am still able to get to kibana's login page, using the new URL but all login attempts fail.

I tried using access logs in elastic search, but seems like kibana logins are not included in the access logs, only GET, PUT or DELETE requests are logged.

What error are you seeing in Kibana when you attempt to login? What does the request and response look like in your browser's dev tools network tab? Is Nginx possibly stripping out any headers (cookies, authentication, etc.) or request params? You should definitely see an authentication exception in your ES logs when a kibana login fails, so it sounds like the requests aren't even reaching elasticsearch.

Thanks for the suggestion @bargs
The dev tool helped. It turned out to be a redirect issue.

Initially search.mysite.com/kibana would redirect to search.mysite.com/login

Setting basepath as "/kibana" in kibana config file solved it.

1 Like

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