# Reverse proxy + XPACK

**URL:** https://discuss.elastic.co/t/reverse-proxy-xpack/267433
**Category:** Kibana
**Tags:** elastic-stack-security
**Created:** [March 17, 2021, 1:14am UTC](https://discuss.elastic.co/t/reverse-proxy-xpack/267433 "2021-03-17T01:14:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![macaulaysouza](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@macaulaysouza](https://discuss.elastic.co/u/macaulaysouza)
#### Post date: [March 17, 2021, 1:14am UTC](https://discuss.elastic.co/t/reverse-proxy-xpack/267433/1 "2021-03-17T01:14:44Z")

</div>

Hi,

I'm trying to setup Nginx to do reverse proxy but I'm struggling to make the X-PACK authentication work.

My infrastruture is composed by HTTPS load balancer + NGINX + Kibana.

I'm currently accessing my Kibana by IP and authenticating using X-PACK. I only want to "hide" it behing NGINX keeping all my URL under the same server.

Any Kibana URL tries to login first but ends in this error message

```auto
{ [Error] request: {}, response: {}, body: '<!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>404</title>404 Not Found', name: 'Error', req: {}, res: {} }
Version: 7.10.1
Build: 36063
Error
    at Fetch._callee3$ (https://URL_KIBANA.net/36063/bundles/core/core.entry.js:6:59535)
    at l (https://URL_KIBANA.net/36063/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:380:1740520)
    at Generator._invoke (https://URL_KIBANA.net/36063/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:380:1740273)
    at Generator.forEach.e.<computed> [as next] (https://URL_KIBANA.net/36063/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:380:1740877)
    at fetch_asyncGeneratorStep (https://URL_KIBANA.net/36063/bundles/core/core.entry.js:6:52652)
    at _next (https://URL_KIBANA.net/36063/bundles/core/core.entry.js:6:52968)

```

I already tried different configurations (Kibana and NGINX) with no sucess.

That is my last config:

```auto
location / {
  proxy_read_timeout 900s;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto http;
  proxy_redirect off;
  proxy_pass http://kibanaIPandportupstream;
}

```

kibana.yml

```auto
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://xxx.xxx.xxx:9200"]
elasticsearch.username: "kibana_system"
elasticsearch.password: "changeme"
elasticsearch.requestHeadersWhitelist: [es-security-runas-user, authorization]
xpack.monitoring.elasticsearch.requestHeadersWhitelist: [es-security-runas-user, authorization]

```

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [April 1, 2021, 5:47pm UTC](https://discuss.elastic.co/t/reverse-proxy-xpack/267433/2 "2021-04-01T17:47:36Z")

</div>

It looks like you are not setting the `server.basePath` setting or any of the other settings that Kibana provides specifically for use with reverse proxies: [Configure Kibana | Kibana Guide [7.12] | Elastic](https://www.elastic.co/guide/en/kibana/current/settings.html)

I found some relevant and helpful information in this other thread: [Nginx reverse proxy setup for Kibana](https://discuss.elastic.co/t/nginx-reverse-proxy-setup-for-kibana/167327)

Here's a user who has a working config with basePath: [Nginx reverse proxy with rewrite and app/kibana#/discover](https://discuss.elastic.co/t/nginx-reverse-proxy-with-rewrite-and-app-kibana-discover/198461)

---

<div class="post-metadata">

### Author: ![macaulaysouza](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@macaulaysouza](https://discuss.elastic.co/u/macaulaysouza)
#### Post date: [April 7, 2021, 11:36pm UTC](https://discuss.elastic.co/t/reverse-proxy-xpack/267433/3 "2021-04-07T23:36:34Z")

</div>

Thanks for replying,

In the end we decided to have a go with Elastic Cloud which made our setup way simpler and easier.

---

<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 5, 2021, 11:36pm UTC](https://discuss.elastic.co/t/reverse-proxy-xpack/267433/4 "2021-05-05T23:36:51Z")

</div>

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