From f47ddcfeaa957dd6571b35e6ba7b761892f186db Mon Sep 17 00:00:00 2001
From: Alexandr Ilenko <AIlenko@IBS.RU>
Date: Mon, 22 Aug 2022 18:33:14 +0300
Subject: [SILABMC-280] Fix: use wsS only when httpS

---
 src/views/Operations/SerialOverLan/SerialOverLanConsole.vue | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/views/Operations/SerialOverLan/SerialOverLanConsole.vue')

diff --git a/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue b/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue
index 694083fd..6b84ab85 100644
--- a/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue
+++ b/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue
@@ -91,9 +91,9 @@ export default {
     openTerminal() {
       const token = this.$store.getters['authentication/token'];
 
-      this.ws = new WebSocket(`wss://${window.location.host}/console0`, [
-        token,
-      ]);
+      const url = new URL('/console0', window.location.href);
+      url.protocol = url.protocol.replace('http', 'ws');
+      this.ws = new WebSocket(url, [token]);
 
       // Refer https://github.com/xtermjs/xterm.js/ for xterm implementation and addons.
 
-- 
cgit v1.2.3

