# Kibana + Shield + NGinx - Thrown back to the login screen

**URL:** <https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211>\
**Category:** Kibana\
**Created:** [March 2, 2016, 8:23am UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211 "2016-03-02T08:23:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![111112](https://avatars.discourse-cdn.com/v4/letter/1/b3f665/32.png) [@111112](https://discuss.elastic.co/u/111112)\
**Post date:** [March 2, 2016, 8:23am UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/1 "2016-03-02T08:23:55Z")

</div>

Hi All,

This is my first ELK installation ( just to be noted ).

I installed ELK with Kibana 4.4 and the access to Kibana routed trough Nginx. I just followed the instructions in the docs and all was good. But then I added Shield, and what happens now is this: I get the Kibana login screen and my credentials are accepted, but then I get the Kibana page only for a few seconds and I am thrown back to the login screen.

I don't see any error messages in the logs of Kibana, Elasticsearch or Nginx.

My /etc/nginx/sites-available/default looks like this:

```
server {
    listen 80;

    server_name elk2.iucc.ac.il;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
        proxy_pass https://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

```

And my kibana.yml just have the normal stuff at the end:

elasticsearch.username: kibana4-server  
elasticsearch.password: k1b@1ucc  
server.ssl.key: /etc/pki/tls/private/logstash-forwarder.key  
server.ssl.cert: /etc/pki/tls/certs/logstash-forwarder.crt  
shield.encryptionKey: "thisisnotmrealsecret"

The only thing I can think of is that I am using the wrong ssl keys, but then I wouldn't see the screen at all, right?

Please help...

Thanks,

Oren

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 2, 2016, 9:24am UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/2 "2016-03-02T09:24:56Z")

</div>

Does it work without nginx?

---

<div class="post-metadata">

**Author:** ![111112](https://avatars.discourse-cdn.com/v4/letter/1/b3f665/32.png) [@111112](https://discuss.elastic.co/u/111112)\
**Post date:** [March 2, 2016, 10:36am UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/3 "2016-03-02T10:36:25Z")

</div>

Mark,

Without nginx ( that is directly from a browser on another PC in the same subnet ), I cannot connect at all. I get a page load failure and there are no related messages in the kibana logs ( this occurs both when nginx is running and when not )

Oren

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [March 2, 2016, 6:58pm UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/4 "2016-03-02T18:58:34Z")

</div>

I suspect that the issue is that you are not proxying the Cookie headers

---

<div class="post-metadata">

**Author:** ![111112](https://avatars.discourse-cdn.com/v4/letter/1/b3f665/32.png) [@111112](https://discuss.elastic.co/u/111112)\
**Post date:** [March 3, 2016, 2:04pm UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/5 "2016-03-03T14:04:56Z")

</div>

Hi all,

Problem fixed. It was caused by the fact that I connected into nginx via http and tried to continue via https.

I changed nginx to listen to https and now I get to the kibana screen.

Thanks, anyway...

Oren

---

<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 6, 2017, 2:00pm UTC](https://discuss.elastic.co/t/kibana-shield-nginx-thrown-back-to-the-login-screen/43211/6 "2017-07-06T14:00:23Z")

</div>


