# Kibana behind apache reverse proxy

**URL:** <https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454>\
**Category:** Kibana\
**Created:** [March 23, 2022, 1:07pm UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454 "2022-03-23T13:07:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_E](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_e/32/47012_2.png) [@Jose\_E](https://discuss.elastic.co/u/Jose_E)\
**Post date:** [March 23, 2022, 1:07pm UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454/1 "2022-03-23T13:07:36Z")

</div>

Hi I'm trying to get kibana working behind and apache reverse proxy. I already have it working, but there's one issue (for which I already have a workaround) but I need to know if it's a configuration issue or a bug. The problem is that the Proxy/ProxyPass from "/" to "/kibana" doesn't work. Let me show you my setup.  
**kibana.yml**

```auto
server.name: "kibana"
server.host: "0.0.0.0"
server.basePath: "/kibana"
server.rewriteBasePath: true
server.publicBaseUrl: "http://localhost:5601/kibana"

```

**Config for apache**

```auto
ProxyPass: '/ http://localhost:5601/kibana/'
ProxyPassReverse: '/ http://localhost:5601/kibana/'
ProxyPreserveHost: true
ProxyRequests: false

```

With this config running, theoretically, whenever I open "[http://localhost/](http://localhost/)" I should land directly in Kibana, but instead I can see a redirect (http 302) towards "[http://localhost/kibana/spaces/enter](http://localhost/kibana/spaces/enter)" with a "not found message" (http 404):

```auto
{"statusCode":404,"error":"Not Found","message":"Not Found"}

```

Has anyone had this same issue? I know the proxy works since everything is as expected if I just used the ProxyPass/ProxyPassReverse with "/kibana [http://localhost:5601/kibana](http://localhost:5601/kibana)", so my only guess is that there's a bug in kibana or I am missing some config.

**Workaround**  
The hack I found to make it work as I want is to use both "/ [http://localhost:5601/kibana](http://localhost:5601/kibana)" and "/kibana [http://localhost:5601/kibana](http://localhost:5601/kibana)" in the Proxy config, it works wonderful but is more of a hack than a propper solution.

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [March 24, 2022, 8:10pm UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454/2 "2022-03-24T20:10:59Z")

</div>

@azasypkin can we please get some help here?

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![Jose\_E](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_e/32/47012_2.png) [@Jose\_E](https://discuss.elastic.co/u/Jose_E)\
**Post date:** [March 28, 2022, 11:59am UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454/3 "2022-03-28T11:59:53Z")

</div>

So turns out that the way I made it work was **removing all the proxy related options**.

```auto
server.basePath: "/kibana"
server.rewriteBasePath: true

```

Which I honestly find confusing, especially when the documentation and everywhere you look for, says you need those too in order to work with a reverse proxy...  
Apparently, the code takes "/" as the base path if you don't specify '_server.basePath_', which is what I was looking for, having also '_ProxyPass/ProxyPassReverse_: / [http://localhost:5601/](http://localhost:5601/)'. This way you can simply access [http://localhost](http://localhost)😕 and takes you to Kibana, no need to add all the paths to the reverse proxy...  
Finally change '_server.host_' to '127.0.0.1' and you don't have to worry about people trying to access kibana through the port, if they come from external connections.

Honestly, I'm a bit mad this case is not considered in the documentation, I feel like a lost more time than I'd like just because the documentation and everywhere I looked told me to use those parameters which aren't really needed.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [March 29, 2022, 9:37am UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454/4 "2022-03-29T09:37:35Z")

</div>

Thanks for sharing the outcome!

Yeah, it's a bit confusing. The `server.basePath: "/kibana"` is used only when users direcly access Kibana through this specific base path (e.g. when you have multiple different applications on the same domain, and use different base path for every such app). In your proxy configuration you just path requests from the root (`/`) to `/kibana`, so users don't really see `/kibana` and Kibana doesn't need it either.

Having said that, we're going to collect more telemetry to better understand the use cases for using proxy for Kibana and know what proxy related docs would be beneficial for our users.

---

<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:** [April 26, 2022, 9:38am UTC](https://discuss.elastic.co/t/kibana-behind-apache-reverse-proxy/300454/5 "2022-04-26T09:38:29Z")

</div>

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