# Kibana behind NGINX

**URL:** https://discuss.elastic.co/t/kibana-behind-nginx/178648
**Category:** Kibana
**Created:** [April 26, 2019, 1:12pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648 "2019-04-26T13:12:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![med\_barka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/med_barka/32/45131_2.png) [@med\_barka](https://discuss.elastic.co/u/med_barka)
#### Post date: [April 26, 2019, 1:12pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/1 "2019-04-26T13:12:50Z")

</div>

Hello,  
i'm using kibana behind reverse proxy along side with a node API application that uses elasticsearch.  
This is config of NGINX :

```
     location / {
            auth_basic "Restricted Access";
            auth_basic_user_file /etc/nginx/htpasswd.users;
            proxy_pass http://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;
       }
location /api/ {
             proxy_pass http://localhost:4000/;
             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;
       }

```

with this configuration, kibana starts but shows blank pages when hitting Discover, visualize and others  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/d/dd560b5419a4bd149660fd2e00359bd04a07e993.png)  
when i remove the /api part of nginx config, things return to normal  
i don't know if it's a problem related to kibana or nginx configuration ??

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [April 26, 2019, 4:27pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/2 "2019-04-26T16:27:49Z")

</div>

Hey @med_barka, Kibana makes various request to `/api/*` so if you're diverting all requests that match that prefix to your other application, Kibana won't work properly.

---

<div class="post-metadata">

### Author: ![med\_barka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/med_barka/32/45131_2.png) [@med\_barka](https://discuss.elastic.co/u/med_barka)
#### Post date: [April 26, 2019, 7:12pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/3 "2019-04-26T19:12:47Z")

</div>

Thanks for your response.. so it's not possible to config it that way? Is there any solution?

---

<div class="post-metadata">

### Author: ![med\_barka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/med_barka/32/45131_2.png) [@med\_barka](https://discuss.elastic.co/u/med_barka)
#### Post date: [April 26, 2019, 7:17pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/4 "2019-04-26T19:17:45Z")

</div>

I changed kibana access to be ' /kibana' with '/api/' and it works... so it can't be done when it's based at '/' ?

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [April 26, 2019, 7:18pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/5 "2019-04-26T19:18:02Z")

</div>

> Is there any solution?

The safest solution is to have kibana being a base-path like `/kibana` and your custom api at `/api` so there isn't any possibility of the proxy diverting requests which are intended to kibana to your custom API.

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [April 26, 2019, 7:18pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/6 "2019-04-26T19:18:51Z")

</div>

Theoretically, you could choose something more obscure like `/super-awesome-api` and the likelihood that it'd intercept the wrong requests goes down.

---

<div class="post-metadata">

### Author: ![med\_barka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/med_barka/32/45131_2.png) [@med\_barka](https://discuss.elastic.co/u/med_barka)
#### Post date: [April 26, 2019, 7:21pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/7 "2019-04-26T19:21:01Z")

</div>

I'll give it a try... thank you Brandon

---

<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: [May 24, 2019, 7:21pm UTC](https://discuss.elastic.co/t/kibana-behind-nginx/178648/8 "2019-05-24T19:21:03Z")

</div>

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