From b829414f4c15678afe916e139ccdd59ec1799d92 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 11 Feb 2024 21:26:26 +0100 Subject: [PATCH] Fixed bug with URLs beginning with multiple slashes being rewritten incorrectly. --- svr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svr.js b/svr.js index b37d361..d1a050e 100644 --- a/svr.js +++ b/svr.js @@ -3332,7 +3332,7 @@ if (!cluster.isPrimary) { if (typeof URL !== "undefined" && url.Url) { try { // Create a new URL object using the provided URI and base URL - var uobject = new URL(uri, "http" + (req.socket.encrypted ? "s" : "") + "://" + (req.headers.host ? req.headers.host : (domain ? domain : "unknown.invalid"))); + var uobject = new URL(uri.replace(/^\/{2,}/,"/"), "http" + (req.socket.encrypted ? "s" : "") + "://" + (req.headers.host ? req.headers.host : (domain ? domain : "unknown.invalid"))); // Create a new URL object (similar to deprecated url.Url) var nuobject = new url.Url();