Skip to content

Commit

Permalink
Fixes ElasticHQ#527: Allow suburl to map the application
Browse files Browse the repository at this point in the history
  • Loading branch information
ella.l committed Sep 24, 2020
1 parent 59f868b commit 1b300e5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ui/src/containers/cluster-nodes/cluster-nodes.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@ class clusterNodesController {
this.clusterName = $stateParams.clusterName;

// Try to get URL
// even if path is being forwared by a Apache / Nginx conf.
// even if path is being forwarded by a Apache / Nginx conf.
// i.e. http://my_site.com/my/custom/path is the root of the python app
console.log('---- window.location', window.location)
let baseUrl = window.location.href.split('/#!')[0];

if (/\:8080/.test(baseUrl)) baseUrl = 'http://localhost:5000';
let url = `${window.location.protocol}//${window.location.host}`;
let baseUrl = window.location.pathname
// console.log('---- baseUrl: ', baseUrl)

if (/\:8080/.test(url)) {
url = 'http://localhost:5000';
}

// Websockets do not work with relative paths, so get absolute and append the WS portion
// upgrade from HTTP to WS should be automatic
// baseUrl = baseUrl += `/ws/nodes/${this.clusterName}/nodes`;
baseUrl = baseUrl += `/ws`;
// console.log('---- baseUrl: ', baseUrl)
// url = url += `/ws/nodes/${this.clusterName}/nodes`;
url = url += `/ws`;
// console.log('---- url: ', url)

this.socket = io(baseUrl);
this.socket = io(url, { path: baseUrl+"socket.io" });
this.socket.on('connect', () => {
this.connected = true;
this.socket.emit('join', {"room_name": this.clusterName + "::nodes"});
Expand Down

0 comments on commit 1b300e5

Please sign in to comment.