1
0
Fork 0
forked from svrjs/svrjs

Fix URL rewriting on URLs with double slashes

This commit is contained in:
Dorian Niemiec 2024-03-02 22:02:24 +01:00
parent 28d633884e
commit 2f232614a2

5
svr.js
View file

@ -4315,7 +4315,10 @@ if (!cluster.isPrimary) {
doCallback = false; doCallback = false;
break; break;
} }
if (!mapEntry.allowDoubleSlashes) address = address.replace(/\/+/g,"/"); if (!mapEntry.allowDoubleSlashes) {
address = address.replace(/\/+/g,"/");
rewrittenURL = address;
}
if (matchHostname(mapEntry.host) && ipMatch(mapEntry.ip, req.socket ? req.socket.localAddress : undefined) && address.match(createRegex(mapEntry.definingRegex)) && !(mapEntry.isNotDirectory && _fileState == 2) && !(mapEntry.isNotFile && _fileState == 1)) { if (matchHostname(mapEntry.host) && ipMatch(mapEntry.ip, req.socket ? req.socket.localAddress : undefined) && address.match(createRegex(mapEntry.definingRegex)) && !(mapEntry.isNotDirectory && _fileState == 2) && !(mapEntry.isNotFile && _fileState == 1)) {
try { try {
mapEntry.replacements.forEach(function (replacement) { mapEntry.replacements.forEach(function (replacement) {