1
0
Fork 0
forked from svrjs/svrjs

Fix web root postfix prefix support

This commit is contained in:
Dorian Niemiec 2024-01-24 19:06:00 +00:00
parent e29d1aa3aa
commit e172c2c005

7
svr.js
View file

@ -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;