forked from svrjs/svrjs
Prevent redirect loops with fallback replacement
This commit is contained in:
parent
2f232614a2
commit
d633707ea5
1 changed files with 4 additions and 0 deletions
4
svr.js
4
svr.js
|
@ -4587,6 +4587,10 @@ if (!cluster.isPrimary) {
|
||||||
var location = "";
|
var location = "";
|
||||||
if (regexI[nonscodeIndex]) {
|
if (regexI[nonscodeIndex]) {
|
||||||
location = req.url.replace(regexI[nonscodeIndex], nonscode.location);
|
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] == " ") {
|
} else if (req.url.split("?")[1] == undefined || req.url.split("?")[1] == null || req.url.split("?")[1] == "" || req.url.split("?")[1] == " ") {
|
||||||
location = nonscode.location;
|
location = nonscode.location;
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue