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) { wwwrootPostfixPrefixesVHost.every(function (currentPostfixPrefix) {
if (req.url.indexOf(currentPostfixPrefix) == 0) { if (req.url.indexOf(currentPostfixPrefix) == 0) {
if (currentPostfixPrefix.match(/\/+$/)) postfixPrefix = currentPostfixPrefix.replace(/\/+$/,""); if (currentPostfixPrefix.match(/\/+$/)) postfixPrefix = currentPostfixPrefix.replace(/\/+$/,"");
else postfixPrefix = currentPostfixPrefix; else if (urlWithPostfix.length == currentPostfixPrefix.length || urlWithPostfix[currentPostfixPrefix.length] == "?" || urlWithPostfix[currentPostfixPrefix.length] == "/" || urlWithPostfix[currentPostfixPrefix.length] == "#") postfixPrefix = currentPostfixPrefix;
urlWithPostfix = urlWithPostFix.substr(postfixPrefix.length); else return true;
urlWithPostfix = urlWithPostfix.substr(postfixPrefix.length);
return false; return false;
} else { } else {
return true; return true;
@ -4273,7 +4274,7 @@ if (!cluster.isPrimary) {
}); });
wwwrootPostfixesVHost.every(function (postfixEntry) { wwwrootPostfixesVHost.every(function (postfixEntry) {
if (matchHostname(postfixEntry.host) && !(postfixEntry.skipRegex && req.url.match(createRegex(postfixEntry.skipRegex)))) { 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; return false;
} else { } else {
return true; return true;