diff --git a/src/static/scripts/admin_diagnostics.js b/src/static/scripts/admin_diagnostics.js index 258df5e1..363b0871 100644 --- a/src/static/scripts/admin_diagnostics.js +++ b/src/static/scripts/admin_diagnostics.js @@ -349,7 +349,13 @@ async function checkHttpResponse() { async function fetchWsUrl(wsUrl) { return new Promise((resolve, reject) => { try { - const ws = new WebSocket(wsUrl); + const url = new URL(wsUrl); + if (url.protocol == 'http:') { + url.protocol = 'ws:'; + } else if (url.protocol == 'https:') { + url.protocol = 'wss:'; + } + const ws = new WebSocket(url.href); ws.onopen = () => { ws.close(); resolve(true); @@ -424,4 +430,4 @@ document.addEventListener("DOMContentLoaded", (event) => { if (btnCopySupport) { btnCopySupport.addEventListener("click", copyToClipboard); } -}); \ No newline at end of file +});