1
0
Fork 0
forked from svrjs/svrjs

Prevent redirect loops with fallback replacement

This commit is contained in:
Dorian Niemiec 2024-03-02 22:11:50 +01:00
parent 2f232614a2
commit d633707ea5

4
svr.js
View file

@ -4587,6 +4587,10 @@ if (!cluster.isPrimary) {
var location = "";
if (regexI[nonscodeIndex]) {
location = req.url.replace(regexI[nonscodeIndex], nonscode.location);
if(location == req.url) {
// Fallback replacement
location = hrefWithoutDuplicateSlashes.replace(regexI[nonscodeIndex], nonscode.location);
}
} else if (req.url.split("?")[1] == undefined || req.url.split("?")[1] == null || req.url.split("?")[1] == "" || req.url.split("?")[1] == " ") {
location = nonscode.location;
} else {