From e172c2c005201b99e533e3b15481fc980a2ade44 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Wed, 24 Jan 2024 19:06:00 +0000 Subject: [PATCH] Fix web root postfix prefix support --- svr.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/svr.js b/svr.js index 13cded1..e211186 100644 --- a/svr.js +++ b/svr.js @@ -4264,8 +4264,9 @@ if (!cluster.isPrimary) { wwwrootPostfixPrefixesVHost.every(function (currentPostfixPrefix) { if (req.url.indexOf(currentPostfixPrefix) == 0) { if (currentPostfixPrefix.match(/\/+$/)) postfixPrefix = currentPostfixPrefix.replace(/\/+$/,""); - else postfixPrefix = currentPostfixPrefix; - urlWithPostfix = urlWithPostFix.substr(postfixPrefix.length); + else if (urlWithPostfix.length == currentPostfixPrefix.length || urlWithPostfix[currentPostfixPrefix.length] == "?" || urlWithPostfix[currentPostfixPrefix.length] == "/" || urlWithPostfix[currentPostfixPrefix.length] == "#") postfixPrefix = currentPostfixPrefix; + else return true; + urlWithPostfix = urlWithPostfix.substr(postfixPrefix.length); return false; } else { return true; @@ -4273,7 +4274,7 @@ if (!cluster.isPrimary) { }); wwwrootPostfixesVHost.every(function (postfixEntry) { if (matchHostname(postfixEntry.host) && !(postfixEntry.skipRegex && req.url.match(createRegex(postfixEntry.skipRegex)))) { - urlWithPostfix = postfixPrefix + "/" + postfixEntry.postfix + req.url; + urlWithPostfix = postfixPrefix + "/" + postfixEntry.postfix + urlWithPostfix; return false; } else { return true;