From cb24c57c9460a9eb82ca834d352a14a04d6de89a Mon Sep 17 00:00:00 2001 From: Forest Johnson Date: Fri, 29 Apr 2022 15:43:52 -0500 Subject: [PATCH] fix: remove extra slash in websocket URL Caddy server will issue a redirect from `//ws` to `/ws` which breaks the websocket -- this change fixes the issue --- injected.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/injected.html b/injected.html index 59b7695..ab395e8 100644 --- a/injected.html +++ b/injected.html @@ -18,7 +18,7 @@ } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; - var address = protocol + window.location.host + window.location.pathname + '/ws'; + var address = protocol + window.location.host + window.location.pathname.replace(/\/$/, "") + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload();