Skip to content

Commit b01309c

Browse files
authored
Mixed content exception in web browser in websocket communication on peek behind an https backproxy. (wled#2571)
"ws://" must be the change to the "wss://" for encryption
1 parent 961d559 commit b01309c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

wled00/data/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ function reconnectWS() {
10001000

10011001
function makeWS() {
10021002
if (ws) return;
1003-
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
1003+
ws = new WebSocket((window.location.protocol == 'https:'?'wss':'ws')+'://'+(loc?locip:window.location.hostname)+'/ws');
10041004
ws.binaryType = "arraybuffer";
10051005
ws.onmessage = function(event) {
10061006
if (event.data instanceof ArrayBuffer) return; //liveview packet

wled00/data/liveviewws.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
ws.send("{'lv':true}");
5252
} else {
5353
console.info("Peek WS opening");
54-
ws = new WebSocket("ws://"+document.location.host+"/ws");
54+
ws = new WebSocket((window.location.protocol == "https:"?"wss":"ws")+"://"+document.location.host+"/ws");
5555
ws.onopen = function () {
5656
console.info("Peek WS open");
5757
ws.send("{'lv':true}");

0 commit comments

Comments
 (0)