Kibana behind apache reverse proxy with different paths?

Hi,

I am struggling a while for now, so hopefully you can open my eyes and point me into the right direction.

I am running multiple kibana instances (for different clusters) in docker and also I am running a single httpd server in docker, which I want to use as reverse proxy.
The httpd config shown below is loaded into the virtual host of httpd config.

I got it running when kibana's server.basePath is identically to the directory which apache is proxying with following configuration:

httpd:

Redirect 		          /kibana /kibana/
ProxyPass                 /kibana/     http://kibana-poc-test:5601/kibana/
ProxyPassReverse          /kibana/   http://kibana-poc-test:5601/kibana/

kibana:

server.port: 5601
server.host: "0"
server.basePath: "/kibana"
server.rewriteBasePath: true

Fine so far. But to keep configuration changes between my clusters as low as possible, I would prefer to run kibana in it's container at root path or at a fixed value (e.g. kibana), regardless which cluster it belongs to.

When I just change kibana to

server.basePath: ""
server.rewriteBasePath: false

and httpd to

Redirect 		  /kibana /kibana/
ProxyPass         /kibana/     http://kibana-poc-test:5601/
ProxyPassReverse  /kibana/   http://kibana-poc-test:5601/

kibana UI does not load.
Dev-Console in Browser shows:

GET http://qdetju/bundles/app/space_selector/bootstrap.js net::ERR_ABORTED 404 (Not Found)

-> so the path is not added.

Where is my mistake?
I need a solution for kibana in versions: 6.4 - 7.0.

Thanks a lot, Andreas

Hey @asp when you're running Kibana behind a reverse-proxy which specifies a path other than the root, you have to configure the server.basePath variable in the kibana.yml. This allows Kibana to render out HTML with a <script> tag which has the src of http://qdetju/${yourBasePathHere}/bundles/app/space_selector/bootstrap.js as opposed to just http://qdetju/bundles/app/space_selector/bootstrap.js

Thanks, using the same folder name on apache proxy on external side and on base path it works as described.

So my question is, do I always the exactly same base path in apache proxy on outside and on routing target? Is no configuration possible (maybe in apache) where I can make kibana available on the outside by https://myserver/kibana_cluster_A and to proxy it to a docker container named kib_cluster_a where kibana is listening on http://0.0.0.0:5601/ (at root in container)?

Is no configuration possible (maybe in apache) where I can make kibana available on the outside by https://myserver/kibana_cluster_A and to proxy it to a docker container named kib_cluster_a where kibana is listening on http://0.0.0.0:5601/ (at root in container)?

Correct, you have to use the basePath setting in this situation.