From ccb812cc3365ea217b35c3422f483866fe7d0c54 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 17 Aug 2016 18:23:30 +1200 Subject: [PATCH] feat(console): add protocol awareness to switch between ws:// and wss:// (#135) --- .../containerConsole/containerConsoleController.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/containerConsole/containerConsoleController.js b/app/components/containerConsole/containerConsoleController.js index 566529458..644e5f3dd 100644 --- a/app/components/containerConsole/containerConsoleController.js +++ b/app/components/containerConsole/containerConsoleController.js @@ -36,7 +36,12 @@ function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, e if (d.Id) { var execId = d.Id; resizeTTY(execId, termHeight, termWidth); - var url = window.location.href.split('#')[0].replace('http://', 'ws://') + 'ws/exec?id=' + execId; + var url = window.location.href.split('#')[0] + 'ws/exec?id=' + execId; + if (url.indexOf('https') > -1) { + url = url.replace('https://', 'wss://'); + } else { + url = url.replace('http://', 'ws://'); + } initTerm(url, termHeight, termWidth); } else { $('#loadConsoleSpinner').hide();