From 3e468bed3d487de61464cde7fd982691ee5fe39a Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Wed, 31 Aug 2022 12:44:35 +0200 Subject: [PATCH] B #~: Fix VMRC with Apache (#2270) (cherry picked from commit bf31d21a17e9d1ca684a44ca8eee8b0acb4e6a0a) --- src/sunstone/public/app/opennebula/vm.js | 4 ++-- src/sunstone/public/app/tabs/vms-tab/actions.js | 3 +++ src/sunstone/public/app/utils/remote-actions.js | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index dd1c90d8d0..1b8c470b74 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -638,9 +638,9 @@ define(function(require) { type: "POST", dataType: "JSON", success: function(vminfo) { - + var fireege_route = Config.publicFireedgeEndpoint.endsWith('/fireedge') ? '' : '/fireedge' $.ajax({ - url: Config.publicFireedgeEndpoint + "/fireedge/api/vcenter/token/" + vm_id, + url: Config.publicFireedgeEndpoint + fireege_route + "/api/vcenter/token/" + vm_id, type: "GET", headers: {"Authorization": fireedge_token}, success: function(token) { diff --git a/src/sunstone/public/app/tabs/vms-tab/actions.js b/src/sunstone/public/app/tabs/vms-tab/actions.js index 2b404afd9a..b014a26316 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -272,6 +272,7 @@ define(function(require) { callback: function(request, response) { var link = RemoteActions.getLink(response,{ port: Config.vncProxyPort, + protocol: Config.vncWSS === "yes" ? "https:" : "http:", connnection_type: "vnc", extra_params: [ "port=" + Config.vncProxyPort, @@ -309,6 +310,7 @@ define(function(require) { var link = RemoteActions.getLink(response,{ host: fireedge_endpoint.hostname, port: fireedge_endpoint.port, + protocol: fireedge_endpoint.protocol, connnection_type: "vmrc", extra_path: "/fireedge/vmrc/" + response.data, }); @@ -338,6 +340,7 @@ define(function(require) { callback: function(request, response) { var link = RemoteActions.getLink(response, { port: Config.vncProxyPort, + protocol: Config.vncWSS === "yes" ? "https:" : "http:", connnection_type: "spice", extra_params: [ "password=" + response.password, diff --git a/src/sunstone/public/app/utils/remote-actions.js b/src/sunstone/public/app/utils/remote-actions.js index 65b4943f1f..c58ae95541 100644 --- a/src/sunstone/public/app/utils/remote-actions.js +++ b/src/sunstone/public/app/utils/remote-actions.js @@ -301,6 +301,7 @@ define(function(require) { options = $.extend({ host: undefined, port: undefined, + protocol: "http:", connnection_type: "", extra_path: "", extra_params: [] @@ -314,7 +315,7 @@ define(function(require) { ]).filter(Boolean); var endpoint = new URL(window.location.href); - var websocketProtocol = endpoint.protocol === "https:" ? "wss:" : "ws:"; + var websocketProtocol = options.protocol === "https:" ? "wss:" : "ws:"; var websocket = websocketProtocol + "//"; @@ -322,7 +323,9 @@ define(function(require) { websocket += options.host + ":" + options.port; else if (options.port) websocket += endpoint.hostname + ":" + options.port; - else + else if (options.host) + websocket += options.host; + else websocket += endpoint.host; websocket += options.extra_path + "?" + params.join("&");