# NGINX reverse proxy problem

**URL:** https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846
**Category:** Kibana
**Created:** [August 3, 2018, 5:41am UTC](https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846 "2018-08-03T05:41:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)
#### Post date: [August 3, 2018, 5:41am UTC](https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846/1 "2018-08-03T05:41:33Z")

</div>

Hi,

I'm having some difficulties with setting up a reverse proxy in combination with iframes. When using `/` as the location browsing to `sub.mydomain.com`, the proxy is working but the root location is skipped and I get the normal Kibana dashboard without any of my own html.

When I change location to something like `/app/kibana` my own html shows but the iframe isn't loaded.

Is there any way to get this to work?

ServerA: Running NGINX and Kibana  
ServerB: Running Elasticsearch, only allows access from ServerA IP

NGINX.conf

```auto
server {
        listen 80;
        listen [::]:80;

        root /var/www/sub.mydomain.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name sub.mydomain.com;

        location / {
                proxy_set_header Host $host;
                proxy_pass http://localhost:5601/;
        }
}
```

HTML snippet

```auto
            <div id="container">
                  <iframe name="frame" iframe id="frame" src="http://localhost:5601/app/kibana#/dashboards"></iframe>
            </div>
```

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [August 3, 2018, 12:23pm UTC](https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846/2 "2018-08-03T12:23:24Z")

</div>

Hey @Sjaak01,

You might have better luck after configuring a base path for Kibana via `server.basePath`, described here: [https://www.elastic.co/guide/en/kibana/current/settings.html](https://www.elastic.co/guide/en/kibana/current/settings.html)

Once the base path is set, you can set your `location` to the configured base path, and have nginx proxy the request from there. Note your iframe src would also change to include this base path.

---

<div class="post-metadata">

### Author: ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)
#### Post date: [August 6, 2018, 4:59am UTC](https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846/3 "2018-08-06T04:59:05Z")

</div>

Thanks.

I tried that before but turns out I didn't remove the localhost part from my iframe src so that caused Kibana to not load.

---

<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: [September 3, 2018, 4:59am UTC](https://discuss.elastic.co/t/nginx-reverse-proxy-problem/142846/4 "2018-09-03T04:59:14Z")

</div>

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