elasticsearch-whatson icon indicating copy to clipboard operation
elasticsearch-whatson copied to clipboard

Running elasticsearch under a subdirectory

Open psaiz opened this issue 7 years ago • 0 comments

First of all, thanks for the very useful plugin!

I have an issue running the plugin on my cluster. I'm using the same port for kibana and elastic, and then, based on the location, I go to kibana or elastic. In other words, under my web server I have https://my.host.domain/elastic and https://my.host.domain/kibana .

So, to reach whatson, I go to https://my.host.domain/elastic/_plugin/whatson. Then, the plugin leaves the 'elasticsearch host' box in the settings empty. If I put there https://my.host.domain/elastic, then the javascript appends :9200.

Would it be possible to have a patch like the following:


diff --git a/_site/assets/js/app.js b/_site/assets/js/app.js
index 1931c33..53701d8 100644
--- a/_site/assets/js/app.js
+++ b/_site/assets/js/app.js
@@ -21,13 +21,8 @@
                        var self = this;
 
                        // Set default configs
-                       if ( '/_plugin/whatson' == window.location.pathname.substr(0,16) ) {
-                               // Running as ES site plugin
-                               self._info.host = window.location.protocol + '//' + window.location.host;
-                       } else {
-                               // Running elsewhere
-                               self._info.host = '';
-                       }
+                       self._info.host = window.location.protocol + '//' + window.location.host + window.location.pathname.replace('/_plugin/whatson', '');
+
                        $( '#navbar-clusterconfig-host' ).val( self._info.host );
                        self._refresh_interval = 5000;
                        $( '#navbar-clusterconfig-refresh' ).val( self._refresh_interval / 1000 );
@@ -65,8 +60,6 @@
                                        host = host.replace(/\/$/g, "");
                                        if ( null == host.match(/^https?:\/\//) )
                                                host = 'http://' + host;
-                                       if ( null == host.match(/:[0-9]*$/) )
-                                               host += ':9200';
 
                                        $( '#navbar-clusterconfig-host' ).val( host );

Thanks a lot, pablo

psaiz avatar Dec 08 '16 16:12 psaiz