diff --git a/src/optimize/BaseOptimizer.js b/src/optimize/BaseOptimizer.js
index 0bf12fbde42d..1818a31702af 100644
--- a/src/optimize/BaseOptimizer.js
+++ b/src/optimize/BaseOptimizer.js
@@ -16,6 +16,7 @@ let babelExclude = [/[\/\\](webpackShims|node_modules|bower_components)[\/\\]/];
class BaseOptimizer {
constructor(opts) {
this.env = opts.env;
+ this.urlBasePath = opts.urlBasePath;
this.bundles = opts.bundles;
this.profile = opts.profile || false;
@@ -74,7 +75,7 @@ class BaseOptimizer {
path: this.env.workingDir,
filename: '[name].bundle.js',
sourceMapFilename: '[file].map',
- publicPath: '/bundles/',
+ publicPath: this.urlBasePath + '/bundles/',
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
},
diff --git a/src/optimize/index.js b/src/optimize/index.js
index 1b2cf69e92e4..003722005111 100644
--- a/src/optimize/index.js
+++ b/src/optimize/index.js
@@ -38,6 +38,7 @@ module.exports = async (kbnServer, server, config) => {
env: bundles.env,
bundles: bundles,
profile: config.get('optimize.profile'),
+ urlBasePath: config.get('server.basePath'),
sourceMaps: config.get('optimize.sourceMaps'),
unsafeCache: config.get('optimize.unsafeCache'),
});
diff --git a/src/optimize/lazy/optmzrRole.js b/src/optimize/lazy/optmzrRole.js
index 6558fd50b707..f2ffcf911279 100644
--- a/src/optimize/lazy/optmzrRole.js
+++ b/src/optimize/lazy/optmzrRole.js
@@ -15,6 +15,7 @@ module.exports = async (kbnServer, kibanaHapiServer, config) => {
profile: config.get('optimize.profile'),
sourceMaps: config.get('optimize.sourceMaps'),
prebuild: config.get('optimize.lazyPrebuild'),
+ urlBasePath: config.get('server.basePath'),
unsafeCache: config.get('optimize.unsafeCache'),
})
);
diff --git a/src/plugins/kibana/public/settings/sections/about/index.html b/src/plugins/kibana/public/settings/sections/about/index.html
index 06adc3de469f..393aa8429d06 100644
--- a/src/plugins/kibana/public/settings/sections/about/index.html
+++ b/src/plugins/kibana/public/settings/sections/about/index.html
@@ -2,7 +2,7 @@
- ![Kibana Barcode Logo](/plugins/kibana/settings/sections/about/barcode.svg)
+ ![Kibana Barcode Logo](../plugins/kibana/settings/sections/about/barcode.svg)
Kibana
diff --git a/src/plugins/kibana/public/settings/sections/status/index.js b/src/plugins/kibana/public/settings/sections/status/index.js
index 4887afcacf4c..9a82bc85fb75 100644
--- a/src/plugins/kibana/public/settings/sections/status/index.js
+++ b/src/plugins/kibana/public/settings/sections/status/index.js
@@ -5,6 +5,6 @@ define(function (require) {
order: 3,
name: 'status',
display: 'Status',
- url: '/status'
+ url: '../status'
};
});
diff --git a/src/plugins/statusPage/public/statusPage.js b/src/plugins/statusPage/public/statusPage.js
index f75d1fd18e42..4daceba0d7c7 100644
--- a/src/plugins/statusPage/public/statusPage.js
+++ b/src/plugins/statusPage/public/statusPage.js
@@ -23,7 +23,7 @@ require('ui/chrome')
// go ahead and get the info you want
return $http
- .get('/api/status')
+ .get('./api/status')
.then(function (resp) {
if (ui.fetchError) {
diff --git a/src/ui/UiApp.js b/src/ui/UiApp.js
index 9f1df9fe880e..5cc7544b660e 100644
--- a/src/ui/UiApp.js
+++ b/src/ui/UiApp.js
@@ -19,7 +19,7 @@ class UiApp {
this.hidden = this.spec.hidden;
this.autoloadOverrides = this.spec.autoload;
this.templateName = this.spec.templateName || 'uiApp';
- this.url = this.spec.url || '/app/' + this.id;
+ this.url = (spec.urlBasePath || '') + (this.spec.url || '/app/' + this.id);
// once this resolves, no reason to run it again
this.getModules = _.once(this.getModules);
diff --git a/src/ui/UiExports.js b/src/ui/UiExports.js
index c314a67378f2..06150249076e 100644
--- a/src/ui/UiExports.js
+++ b/src/ui/UiExports.js
@@ -4,9 +4,10 @@ var minimatch = require('minimatch');
var UiAppCollection = require('./UiAppCollection');
class UiExports {
- constructor(kbnServer) {
+ constructor({ urlBasePath }) {
this.apps = new UiAppCollection(this);
this.aliases = {};
+ this.urlBasePath = urlBasePath;
this.exportConsumer = _.memoize(this.exportConsumer);
this.consumers = [];
this.bundleProviders = [];
@@ -48,7 +49,10 @@ class UiExports {
case 'apps':
return (plugin, specs) => {
for (let spec of [].concat(specs || [])) {
- let app = this.apps.new(_.defaults({}, spec, { id: plugin.id }));
+ let app = this.apps.new(_.defaults({}, spec, {
+ id: plugin.id,
+ urlBasePath: this.urlBasePath
+ }));
plugin.apps.add(app);
}
};
diff --git a/src/ui/index.js b/src/ui/index.js
index f2ded3b539c2..7abd07dcd690 100644
--- a/src/ui/index.js
+++ b/src/ui/index.js
@@ -12,10 +12,13 @@ module.exports = async (kbnServer, server, config) => {
let UiBundlerEnv = require('./UiBundlerEnv');
let loadingGif = readFile(fromRoot('src/ui/public/loading.gif'), { encoding: 'base64'});
- let uiExports = kbnServer.uiExports = new UiExports(kbnServer);
+ let uiExports = kbnServer.uiExports = new UiExports({
+ urlBasePath: config.get('server.basePath')
+ });
let bundlerEnv = new UiBundlerEnv(config.get('optimize.bundleDir'));
bundlerEnv.addContext('env', config.get('env.name'));
+ bundlerEnv.addContext('urlBasePath', config.get('server.basePath'));
bundlerEnv.addContext('sourceMaps', config.get('optimize.sourceMaps'));
bundlerEnv.addContext('kbnVersion', config.get('pkg.version'));
bundlerEnv.addContext('buildNum', config.get('pkg.buildNum'));
@@ -72,13 +75,15 @@ module.exports = async (kbnServer, server, config) => {
version: kbnServer.version,
buildNum: config.get('pkg.buildNum'),
buildSha: config.get('pkg.buildSha'),
+ basePath: config.get('server.basePath'),
vars: defaults(app.getInjectedVars(), defaultInjectedVars),
};
return this.view(app.templateName, {
app: app,
loadingGif: loadingGif,
- kibanaPayload: payload
+ kibanaPayload: payload,
+ bundlePath: config.get('server.basePath') + '/bundles',
});
});
};
diff --git a/src/ui/public/chrome/api/angular.js b/src/ui/public/chrome/api/angular.js
index 91c35fb591c3..88af1b856b40 100644
--- a/src/ui/public/chrome/api/angular.js
+++ b/src/ui/public/chrome/api/angular.js
@@ -21,7 +21,7 @@ module.exports = function (chrome, internals) {
.value('sessionId', Date.now())
.value('esUrl', (function () {
var a = document.createElement('a');
- a.href = '/elasticsearch';
+ a.href = '../elasticsearch';
return a.href;
}()))
.directive('kbnChrome', function ($rootScope) {
diff --git a/src/ui/public/chrome/chrome.js b/src/ui/public/chrome/chrome.js
index 5a162d79980a..e331e477ef15 100644
--- a/src/ui/public/chrome/chrome.js
+++ b/src/ui/public/chrome/chrome.js
@@ -9,7 +9,6 @@ require('ui/private');
require('ui/promises');
var metadata = require('ui/metadata');
-var TabCollection = require('ui/chrome/TabCollection');
var chrome = {};
var internals = _.defaults(
diff --git a/src/ui/views/uiApp.jade b/src/ui/views/uiApp.jade
index 96e3c445f35e..09407d5586b2 100644
--- a/src/ui/views/uiApp.jade
+++ b/src/ui/views/uiApp.jade
@@ -38,11 +38,17 @@ block content
loading.removeChild(loading.lastChild);
}
+ function bundleFile(filename) {
+ var anchor = document.createElement('a');
+ anchor.setAttribute('href', !{JSON.stringify(bundlePath)} + '/' + filename);
+ return anchor.href;
+ }
+
var files = [
- '/bundles/commons.style.css',
- '/bundles/#{app.id}.style.css',
- '/bundles/commons.bundle.js',
- '/bundles/#{app.id}.bundle.js'
+ bundleFile('commons.style.css'),
+ bundleFile('#{app.id}.style.css'),
+ bundleFile('commons.bundle.js'),
+ bundleFile('#{app.id}.bundle.js')
];
(function next() {