mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
Allow elasticsearch URL be relative
Like https://myweblog/elasticsearch url.resolve will strip a path component and assume elasticsearch sits at the root URL.
This commit is contained in:
parent
cfd7aea64c
commit
864b491b51
1 changed files with 4 additions and 2 deletions
|
@ -5,8 +5,10 @@ module.exports = function mapUri(server, prefix) {
|
||||||
return function (request, done) {
|
return function (request, done) {
|
||||||
var path = request.path.replace('/elasticsearch', '');
|
var path = request.path.replace('/elasticsearch', '');
|
||||||
var url = config.get('elasticsearch.url');
|
var url = config.get('elasticsearch.url');
|
||||||
if (!/\/$/.test(url)) url += '/';
|
if (path) {
|
||||||
if (path) url = resolve(url, path);
|
if (/\/$/.test(url)) url = url.substring(0, url.length - 1);
|
||||||
|
url += path;
|
||||||
|
}
|
||||||
var query = querystring.stringify(request.query);
|
var query = querystring.stringify(request.query);
|
||||||
if (query) url += '?' + query;
|
if (query) url += '?' + query;
|
||||||
done(null, url);
|
done(null, url);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue