1
0
Fork 0
forked from svrjs/svrjs

Fix errors with web root postfix adding functionality

This commit is contained in:
Dorian Niemiec 2024-03-02 22:41:26 +01:00
parent 0f0c1b22ab
commit cbbe4c9bc5

4
svr.js
View file

@ -1176,6 +1176,7 @@ var disableTrailingSlashRedirects = false;
var environmentVariables = {}; var environmentVariables = {};
var wwwrootPostfixesVHost = []; var wwwrootPostfixesVHost = [];
var wwwrootPostfixPrefixesVHost = []; var wwwrootPostfixPrefixesVHost = [];
var allowPostfixDoubleSlashes = false;
// Get properties from config.json // Get properties from config.json
if (configJSON.blacklist != undefined) rawBlackList = configJSON.blacklist; if (configJSON.blacklist != undefined) rawBlackList = configJSON.blacklist;
@ -1231,6 +1232,7 @@ if (configJSON.disableTrailingSlashRedirects != undefined) disableTrailingSlashR
if (configJSON.environmentVariables != undefined) environmentVariables = configJSON.environmentVariables; if (configJSON.environmentVariables != undefined) environmentVariables = configJSON.environmentVariables;
if (configJSON.wwwrootPostfixesVHost != undefined) wwwrootPostfixesVHost = configJSON.wwwrootPostfixesVHost; if (configJSON.wwwrootPostfixesVHost != undefined) wwwrootPostfixesVHost = configJSON.wwwrootPostfixesVHost;
if (configJSON.wwwrootPostfixPrefixesVHost != undefined) wwwrootPostfixPrefixesVHost = configJSON.wwwrootPostfixPrefixesVHost; if (configJSON.wwwrootPostfixPrefixesVHost != undefined) wwwrootPostfixPrefixesVHost = configJSON.wwwrootPostfixPrefixesVHost;
if (configJSON.allowPostfixDoubleSlashes != undefined) allowPostfixDoubleSlashes = configJSON.allowPostfixDoubleSlashes
var wwwrootError = null; var wwwrootError = null;
try { try {
@ -4369,7 +4371,7 @@ if (!cluster.isPrimary) {
// Add web root postfixes // Add web root postfixes
if (!isProxy) { if (!isProxy) {
var preparedReqUrl3 = (postFixEntry.allowDoubleSlashes ? (href.replace(/\/+/,"/") + (uobject.search ? uobject.search : "")) + (uobject.hash ? uobject.hash : "")) : req.url); var preparedReqUrl3 = (allowPostfixDoubleSlashes ? (href.replace(/\/+/,"/") + (uobject.search ? uobject.search : "") + (uobject.hash ? uobject.hash : "")) : req.url);
var urlWithPostfix = preparedReqUrl3; var urlWithPostfix = preparedReqUrl3;
var postfixPrefix = ""; var postfixPrefix = "";
wwwrootPostfixPrefixesVHost.every(function (currentPostfixPrefix) { wwwrootPostfixPrefixesVHost.every(function (currentPostfixPrefix) {