# Kibana logout not working when using nginx reverse proxy

**URL:** <https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [November 10, 2019, 6:57am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230 "2019-11-10T06:57:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elk11](https://avatars.discourse-cdn.com/v4/letter/e/45deac/32.png) [@elk11](https://discuss.elastic.co/u/elk11)\
**Post date:** [November 10, 2019, 6:57am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/1 "2019-11-10T06:57:06Z")

</div>

Hi,

I know currently there's no anonymous access native in Kibana. I was trying to put nginx container in front to pass credentials to Kibana. So when i access kibana url it directly logs in as a default user. So far so good.

But when i try to logout, to login as a different user, I wasn't prompted a login screen. i hit /logout and again directly get's logged in as default user. I tried to manually access /login uri with kibana url. It prompted me for login, but again i'm logged in as default creds even though i had entered super user creds.

Is there something different about how Kibana handled /logout and /login which i should be aware of while configuring nginx?

As you can see in my nginx conf, i configured it to add default creds only if authorization header is empty.

below is my current nginx conf:

```
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;

ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;

map $sent_http_authorization $auth {
     default $sent_http_authorization;
     "" "Basic ZGVmYXVsdDpkZWZhdWx0";
}

server {
     listen 5601;
     listen 443 ssl;

     server_name <MY_SERVER>:443;

     if ($server_port = 5601) {
         return 301 https://$server_name$request_uri;
     }

     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $remote_addr;

     location / {
            proxy_set_header Authorization $auth;
            proxy_pass https://kibana:5601;
     }

}
```

---

<div class="post-metadata">

**Author:** ![elk11](https://avatars.discourse-cdn.com/v4/letter/e/45deac/32.png) [@elk11](https://discuss.elastic.co/u/elk11)\
**Post date:** [November 10, 2019, 7:49am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/2 "2019-11-10T07:49:59Z")

</div>

Similar unanswered question here: [https://stackoverflow.com/questions/57510929/how-to-logout-after-using-nginx-as-reverse-proxy#](https://stackoverflow.com/questions/57510929/how-to-logout-after-using-nginx-as-reverse-proxy#)

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [November 11, 2019, 5:55am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/3 "2019-11-11T05:55:48Z")

</div>

> [@elk11](#):
>
> nf, i configured it to add default creds only if authorization header is empty.
> 
> below is my current nginx co

[X-pack Kibana Logout redirection](https://discuss.elastic.co/t/x-pack-kibana-logout-redirection/108081) talks about redirection of url. But @Oleg can throw more light on this..

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![elk11](https://avatars.discourse-cdn.com/v4/letter/e/45deac/32.png) [@elk11](https://discuss.elastic.co/u/elk11)\
**Post date:** [November 15, 2019, 11:44am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/4 "2019-11-15T11:44:43Z")

</div>

Thanks for reply @rashmi

If someone could assist me on this it would be of great help!

---

<div class="post-metadata">

**Author:** ![elk11](https://avatars.discourse-cdn.com/v4/letter/e/45deac/32.png) [@elk11](https://discuss.elastic.co/u/elk11)\
**Post date:** [November 17, 2019, 8:09am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/5 "2019-11-17T08:09:05Z")

</div>

@tsullivan pinging you because i used your solution from here: [Auto-authenticating to iframe-embedded Kibana dashboard](https://discuss.elastic.co/t/auto-authenticating-to-iframe-embedded-kibana-dashboard/46091/4) Any suggestions on how to fix this logout issue?

---

<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:** [December 15, 2019, 8:09am UTC](https://discuss.elastic.co/t/kibana-logout-not-working-when-using-nginx-reverse-proxy/207230/6 "2019-12-15T08:09:06Z")

</div>

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