mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -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) {
|
||||
var path = request.path.replace('/elasticsearch', '');
|
||||
var url = config.get('elasticsearch.url');
|
||||
if (!/\/$/.test(url)) url += '/';
|
||||
if (path) url = resolve(url, path);
|
||||
if (path) {
|
||||
if (/\/$/.test(url)) url = url.substring(0, url.length - 1);
|
||||
url += path;
|
||||
}
|
||||
var query = querystring.stringify(request.query);
|
||||
if (query) url += '?' + query;
|
||||
done(null, url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue