- Kibana Guide: other versions:
- What is Kibana?
- What’s new in 7.8
- Get started
- Set up Kibana
- Discover
- Dashboard
- Canvas
- Maps
- Machine learning
- Graph
- Visualize
- Logs
- Metrics
- APM
- Uptime
- SIEM
- Dev Tools
- Stack Monitoring
- Management
- Advanced Settings
- Alerts and Actions
- Beats Central Management
- Cross-Cluster Replication
- Index Lifecycle Policies
- Index Management
- Ingest Node Pipelines
- Index patterns and fields
- License Management
- Numeral Formatting
- Remote Clusters
- Rollup Jobs
- Saved Objects
- Security
- Snapshot and Restore
- Spaces
- Upgrade Assistant
- Watcher
- Ingest Manager
- Reporting
- Alerting and Actions
- REST API
- Kibana plugins
- Accessibility
- Limitations
- Breaking Changes
- Release Notes
- Kibana 7.8.1
- Kibana 7.8.0
- Kibana 7.7.1
- Kibana 7.7.0
- Kibana 7.6.2
- Kibana 7.6.1
- Kibana 7.6.0
- Kibana 7.5.2
- Kibana 7.5.1
- Kibana 7.5.0
- Kibana 7.4.2
- Kibana 7.4.1
- Kibana 7.4.0
- Kibana 7.3.2
- Kibana 7.3.1
- Kibana 7.3.0
- Kibana 7.2.1
- Kibana 7.2.0
- Kibana 7.1.1
- Kibana 7.1.0
- Kibana 7.0.1
- Kibana 7.0.0
- Kibana 7.0.0-rc2
- Kibana 7.0.0-rc1
- Kibana 7.0.0-beta1
- Kibana 7.0.0-alpha2
- Kibana 7.0.0-alpha1
- Developer guide
Considerations for basePath
editConsiderations for basePath
editAll communication from the Kibana UI to the server needs to respect the
server.basePath
. Here are the "blessed" strategies for dealing with this
based on the context:
Getting a static asset url
editUse webpack to import the asset into the build. This will give you a URL in JavaScript and gives webpack a chance to perform optimizations and cache-busting.
// in plugin/public/main.js import uiChrome from 'ui/chrome'; import logoUrl from 'plugins/facechimp/assets/banner.png'; uiChrome.setBrand({ logo: `url(${logoUrl}) center no-repeat` });
API requests from the front-end
editUse chrome.addBasePath()
to append the basePath to the front of the url.
import chrome from 'ui/chrome'; $http.get(chrome.addBasePath('/api/plugin/things'));
Server side
editAppend request.getBasePath()
to any absolute URL path.
const basePath = server.config().get('server.basePath'); server.route({ path: '/redirect', handler(request, h) { return h.redirect(`${request.getBasePath()}/otherLocation`); } });
BasePathProxy in dev mode
editThe Kibana dev server automatically runs behind a proxy with a random
server.basePath
. This way developers will be constantly verifying that their
code works with basePath, while they write it.
To accomplish this the serve
task does a few things:
-
change the port for the server to the
dev.basePathProxyTarget
setting (default5603
) -
start a
BasePathProxy
atserver.port
-
picks a random 3-letter value for
randomBasePath
-
redirects from
/
to/{randomBasePath}
-
redirects from
/{any}/app/{appName}
to/{randomBasePath}/app/{appName}
so that refreshes should work -
proxies all requests starting with
/{randomBasePath}/
to the Kibana server
-
picks a random 3-letter value for
If you’re writing scripts that interact with the Kibana API, the base path proxy will likely
make this difficult. To bypass the base path proxy for a single request, prefix urls with
__UNSAFE_bypassBasePath
and the request will be routed to the development Kibana server.
curl "http://elastic:changeme@localhost:5601/__UNSAFE_bypassBasePath/api/status"
This proxy can sometimes have unintended side effects in development, so when
needed you can opt out by passing the --no-base-path
flag to the serve
task
or yarn start
.
yarn start --no-base-path
On this page
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register now