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

**URL:** https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816
**Category:** Kibana
**Created:** [September 8, 2017, 8:32am UTC](https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816 "2017-09-08T08:32:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![parth126](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@parth126](https://discuss.elastic.co/u/parth126)
#### Post date: [September 8, 2017, 8:32am UTC](https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816/1 "2017-09-08T08:32:15Z")

</div>

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](http://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.

---

<div class="post-metadata">

### Author: ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)
#### Post date: [September 11, 2017, 9:28pm UTC](https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816/2 "2017-09-11T21:28:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![parth126](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@parth126](https://discuss.elastic.co/u/parth126)
#### Post date: [September 12, 2017, 7:17am UTC](https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816/3 "2017-09-12T07:17:36Z")

</div>

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

Initially [search.mysite.com/kibana](http://search.mysite.com/kibana) would redirect to [search.mysite.com/login](http://search.mysite.com/login)

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 10, 2017, 7:17am UTC](https://discuss.elastic.co/t/kibana-authentication-using-x-pack-fails-when-running-behind-nginx-proxy/99816/4 "2017-10-10T07:17:44Z")

</div>

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