# Kibana - SESSSION\_EXPIRED right after login

**URL:** https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061
**Category:** Kibana
**Created:** [June 20, 2017, 8:41am UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061 "2017-06-20T08:41:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Benjamin\_Dahon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_dahon/32/20718_2.png) [@Benjamin\_Dahon](https://discuss.elastic.co/u/Benjamin_Dahon)
#### Post date: [June 20, 2017, 8:41am UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/1 "2017-06-20T08:41:34Z")

</div>

I have a kibana cluster up and running with xpack security enabled. Whenever I try to login, I see the homepage being displayed and right after a redirect happens (in js) to the login page again with the "Your session has expired. Please log in again." message being displayed.

On the network tab in chrome, I can see the POST to /api/security/v1/login being successful, but then the next call (/api/xpack/v1/info) gets a 401

The same instance works fine if I access kibana on localhost:5601, the problem only appears when I go through my nginx reverse proxy.

Where can I find documentation for this matter ?

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [June 20, 2017, 12:53pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/2 "2017-06-20T12:53:44Z")

</div>

Hi,

Which version of Kibana are you running? We have documentation on x-pack security but we don't really support nginx proxy. We know a lot of our users use it though.

If you could tell me your Kibana version and your config for the proxy, I will try to reproduce it in my local.

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![Benjamin\_Dahon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_dahon/32/20718_2.png) [@Benjamin\_Dahon](https://discuss.elastic.co/u/Benjamin_Dahon)
#### Post date: [June 20, 2017, 2:45pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/3 "2017-06-20T14:45:31Z")

</div>

Hi,

I am actually running on Docker, using the [elastic.co](http://elastic.co) 5.4 image: [docker.elastic.co/kibana/kibana:5.4.0](http://docker.elastic.co/kibana/kibana:5.4.0)

This docker image runs on a kubernetes cluster. Below is the nginx configuration used:

```
server {
 server_name xxx;
 listen 80;
 listen 443 ssl spdy http2;
 ssl_certificate xxx;
 ssl_certificate_key xxx;

 more_set_headers "Strict-Transport-Security: max-age=15724800; preload";

 location / {
     # enforce ssl on server side
     if ($scheme = http) {
         return 301 https://$host$request_uri;
     }

     proxy_set_header Host $host;

     # Pass Real IP
     proxy_set_header X-Real-IP $remote_addr;

     # Allow websocket connections
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection $connection_upgrade;

     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Host $host;
     proxy_set_header X-Forwarded-Port $server_port;
     proxy_set_header X-Forwarded-Proto $pass_access_scheme;

     # mitigate HTTPoxy Vulnerability
     # https://www.nginx.com/blog/mitigating-the-httpoxy-vulnerability-with-nginx/
     proxy_set_header Proxy "";

     proxy_connect_timeout 600s;
     proxy_send_timeout 60s;
     proxy_read_timeout 600s;

     proxy_redirect off;
     proxy_buffering off;

     proxy_http_version 1.1;

     proxy_pass http://kibana-svc-5601;
 }

```

}

---

<div class="post-metadata">

### Author: ![Benjamin\_Dahon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_dahon/32/20718_2.png) [@Benjamin\_Dahon](https://discuss.elastic.co/u/Benjamin_Dahon)
#### Post date: [June 20, 2017, 5:05pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/4 "2017-06-20T17:05:40Z")

</div>

Hi,

I actually found the issue, my mistake. I had many kibana instances running behind nginx, but without any sort of session affinity. I now have how to figure how to do that with kibana.

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [June 20, 2017, 5:13pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/5 "2017-06-20T17:13:04Z")

</div>

Hi Benjamin,

I am not sure when I am getting to reproducing this in my local. Especially because I have never done it with docker/kubernetes. I will try later tonight or get some help.

Can you please checkout these posts in the meantime? `nginx` [https://discuss.elastic.co/search?q=nginx%20category%3A7](https://discuss.elastic.co/search?q=nginx%20category%3A7) May be they will help?

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![Benjamin\_Dahon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_dahon/32/20718_2.png) [@Benjamin\_Dahon](https://discuss.elastic.co/u/Benjamin_Dahon)
#### Post date: [June 21, 2017, 11:50am UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/6 "2017-06-21T11:50:55Z")

</div>

Hi Bhavya,

It seems I responded about the same time as you actually wrote your post. Please my above me previous comment.

Thanks  
Benjamin

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [June 21, 2017, 12:51pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/7 "2017-06-21T12:51:51Z")

</div>

Ah Ok. Thanks for keeping us posted.

Cheers,  
Bhavya

---

<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: [July 19, 2017, 12:52pm UTC](https://discuss.elastic.co/t/kibana-sesssion-expired-right-after-login/90061/8 "2017-07-19T12:52:01Z")

</div>

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