404 GET _fields_for_wildcards error in kibana

Kibana version: 6.2.3

Elasticsearch version:6.2.3

Bowser version: Firefox 60.0.1 (64-bit)

OS: CentOS 6

Apache Reverse Proxy Conf:

<Location /elasticsearch>
ProxyPass http://localhost:5601/elasticsearch
ProxyPassReverse http://localhost:5601/elasticsearch
<Location /app/kibana>
ProxyPass http://localhost:5601/app/kibana
ProxyPassReverse http://localhost:5601/app/kibana
<Location /api/saved_objects>
ProxyPass http://localhost:5601/api/saved_objects
ProxyPassReverse http://localhost:5601/api/saved_objects
<Location /ui/fonts/open_sans/>
ProxyPass http://localhost:5601/ui/fonts/open_sans/
ProxyPassReverse http://localhost:5601/ui/fonts/open_sans/
<Location /bundles>
ProxyPass http://localhost:5601/bundles
ProxyPassReverse http://localhost:5601/bundles

Description of the problem:

I put Kibana behind the apache reverse proxy. Many things seem fine, I can access kibana through https://XXXXX/app/kibana and I can also find my indexes in elasticsearch through Management -> Create New Index, I can also find data in Discover. Everything's fine until maybe some configs I don't know have been changed. When I want to refresh an index, there will be 404 GET _fields_for_wildcards error. If I go create a new index, hit the create index pattern button, there will also be 404 Get _fields_for_wildcards error.

In kibana.yml, only server.name is enabled. Before the crash, I've set the server.bathPath to "/kibana" and it works fine. But when crash happens it keeps prompting the red label "kibana is not loaded properly, balabala" until I comment the server.bathPath. I'm very confused about that sudden crash.

Refresh iptables index:


image

Create dnsq index:
image
image

Hey @kesha, you're only proxying specific URLs to Kibana, which is really brittle, is there any reason why you aren't doing something similar to the following?

<Location />
  ProxyPass http://localhost:5601/
  ProxyPassReverse http://localhost:5601/
</Location>

Or, if you'd like to host Kibana on a virtual directory, you can set the following in your kibana.yml

server.basePath: /kibana

and then use the following Apache configuration:

<Location /kibana/ >
  ProxyPass http://localhost:5601/
  ProxyPassReverse http://localhost:5601/
</Location>

Hi @Brandon_Kobel, thank you for the reply! I've modified the apache config and kibana.yml just as you said and they work perfectly. Actually I want to proxy kibana on a real+virtual directory, like https://XXXXX/{real directory}/{virtual directory}/, for product purpose. I'm figuring out how to do this. But I'm a newbie and I'm still learning. I'm still confused about the difference between https://XXXXX/kibana/ and https://XXXXX/app/kibana/. Why the latter URL is brittle and the former is good?

Thanks!
Ke

Hey @kesha, hosting Kibana at a basePath of /kibana/ makes https://XXXXX/kibana/ and a viable hosting strategy, and all Kibana URLS will be generated as children of https://XXXXX/kibana/, so you get https://XXXXX/kibana/app/kibana, https://XXXXX/kibana/api/saved_objects, etc.

the /app/kibana route is an internal route that we use, so taking your previous approach you have to ensure that all internal routes are designated to be proxied to Kibana. That's what was happening previously, there was an api/index_patterns route which you missed, and it was causing the 404s to appear.

Thanks @Brandon_Kobel! That really helps!

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