Hello, I generated a sample plugin from the Kibana scripts, and added the "publicDir" option in order to serve static files like images from within my plugin:
// From my plugin's index.js
export default function (kibana) {
return new kibana.Plugin({
require: ['kibana'],
publicDir: resolve(__dirname, 'public'), // <-- I added this to serve static files
uiExports: {
...
I added a static asset called rhino.png in the "public" subfolder in my plugin directory:
/me/kibana_plugin/kibana/plugins/my_plugin $ find . | grep png
./public/rhino.png
I generated a zip file for my plugin, so I can install it in a kibana distribution:
$ yarn build
$ ls build/
my_plugin-0.0.0.zip
I installed the plugin zip in a freshly downloaded Kibana distribution.
/me/tmp/kibana-7.3.0-darwin-x86_64 $ bin/kibana-plugin install file:///me/kibana_plugin/kibana/plugins/my_plugin/build/my_plugin-0.0.0.zip
Attempting to transfer from file:///me/kibana_plugin/kibana/plugins/my_plugin/build/my_plugin-0.0.0.zip
Transferring 106382 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Plugin installation complete
Now I configured a server.basePath in kibana.yml
/me/tmp/kibana-7.3.0-darwin-x86_64 $ grep basePath config/kibana.yml
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
server.basePath: "/xxx"
...
With Kibana server running, now I expect the following URL to serve the image respecting server.basePath, but it goes 404:
http://localhost:5601/xxx/plugins/my_plugin/rhino.png <-- 404
However, when I remove the basePath from the url, it still works:
http://localhost:5601/plugins/my_plugin/rhino.png <-- still returns the picture
Is there a way to make this work? Is it a bug?
Thanks