-
Notifications
You must be signed in to change notification settings - Fork 17
KibanaDev.BasePathProxy
server.basePath
is a setting you can set to tell Kibana that it's running "within" a subdirectory of a domain. When this is the case Kibana must include the server.basePath
in any absolute URL it creates.
For example: An organization might have a single domain for "log management", https://logmgmt.internal.net
, and they want to expose kibana 4 at https://logmgmt.internal.net/kibana4/
. They would need to set server.basePath: '/kibana4'
This function works great, but it has to be respected by every url created, and since urls are created all over the place we needed a way to ensure we weren't forgetting about basePath. Our solution is to automatically run the dev server behind a random server.basePath
. This way developers would 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
This proxy can sometime have unintended side effects (like https://github.com/elastic/kibana/issues/5962), so when needed you can opt out by passing the --no-base-path
flag to the serve
task or npm start
npm start -- --no-base-path