404 error for just /api calls. Nginx as proxy

I'm running Kibana 7.3 behind an Nginx proxy (in Kubernetes) and most things work but the /api calls don't seem to respect the basePath configuration. I set the basePath value and most calls prepend that and work, but all the /api calls don't prepend the basePath and therefore get 404 errors. Anyone else get this problem? Any solutions?

I worked around this issue by adding a location /api section that then adds the api:

location /api {
rewrite ^/api/(/.*)$ /api/$1 permanent;
}

The plugin should just prepend my basepath /mybasepath/api and then i wouldn't have had to do this.

Hope are you configuring the base path? The/api endpoint should 100% respect the basePath

Yea the basePath is definitely used because all of Kibana works except for the /api calls.

I don't see prepending basePath here:

 $.ajax({
  url:
    '../api/console/api_server?sense_version=' +
    encodeURIComponent('@@SENSE_VERSION') +
    '&apis=' +
    encodeURIComponent(api),

dataType: 'json', // disable automatic guessing

Sorry, I meant to ask "How are you configuring the base path?" Typing is hard...

I should add that the bit of code you reference contains a relative url in order to support the base path.

This is running in Kubernetes using a nginx ingress controller proxy and I see the nginx.conf has /api location block for something else. But I don't understand why that would affect this case. If /mybasepath/api is then sent to Kibana /api it shouldn't matter that something else calls /api that goes to another application.

Does anyone know if the basepath is passed over in the header. What if the proxy somehow removes the basepath?

Does anyone know if the basepath is passed over in the header. What if the proxy somehow removes the basepath?

The basepath is set via kibana.yml or arguments passed when the process is started - https://www.elastic.co/guide/en/kibana/current/settings.html

Can you connect to kibana without the proxy to see if you have the same problem?

Yes Kibana works without the proxy and it works with the proxy with the exception of the api calls. It only visibly affects things if I want to use the monitoring plugin otherwide for what I need it works. I do have the basePath set in kibana.yml by the way. No one else seems to run into this problem so maybe it's something weird with my setup with Kubernetes ingress controller.

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