From d1a2b77ce370e5cc7a692bd96a859df8ed131f7e Mon Sep 17 00:00:00 2001 From: m33ts4k0z Date: Sun, 2 Aug 2020 22:18:42 +0200 Subject: [PATCH] fix(webui): works now with https port 443 (#924) * Websocket fix for SSL reverse proxies * docs: add changelog Co-authored-by: Sersch --- CHANGELOG.md | 2 +- assets/webconfig/js/hyperion.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca41558d..399a3853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed - +- webui: Works now with https port 443 (#923 with #924) ### Removed ## [2.0.0-alpha.7](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.0-alpha.7) - 2020-07-23 diff --git a/assets/webconfig/js/hyperion.js b/assets/webconfig/js/hyperion.js index bfbaf7a7..b06805e7 100644 --- a/assets/webconfig/js/hyperion.js +++ b/assets/webconfig/js/hyperion.js @@ -76,7 +76,13 @@ function initWebSocket() { if (window.websocket == null) { - window.jsonPort = (document.location.port == '') ? '80' : document.location.port; + window.jsonPort = ''; + if(document.location.port == '' && document.location.protocol == "http:") + window.jsonPort = '80'; + else if (document.location.port == '' && document.location.protocol == "https:") + window.jsonPort = '443'; + else + window.jsonPort = document.location.port; window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://'+document.location.hostname+":"+window.jsonPort) : new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort); window.websocket.onopen = function (event) {