From 4185ec20b0dd0857973a1348756c8c50cdc7d711 Mon Sep 17 00:00:00 2001 From: Nelson Chan <3271800+chakflying@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:35:39 +0800 Subject: [PATCH] Fix: Origin undefined on error handling (#4224) --- server/uptime-kuma-server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index d20021909..5742b29ac 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -134,9 +134,10 @@ class UptimeKumaServer { log.info("auth", "WebSocket with no origin is allowed"); callback(null, true); } else { + let host = req.headers.host; + let origin = req.headers.origin; + try { - let host = req.headers.host; - let origin = req.headers.origin; let originURL = new URL(origin); let xForwardedFor; if (await Settings.get("trustProxy")) {