forked from svrjs/svrjs
Fix web root postfix prefix support
This commit is contained in:
parent
e29d1aa3aa
commit
e172c2c005
1 changed files with 4 additions and 3 deletions
7
svr.js
7
svr.js
|
@ -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;
|
||||||
|
|
Reference in a new issue