1
0
Fork 0
forked from svrjs/svrjs

Moved invalid X-Forwader-For header handler

This commit is contained in:
Dorian Niemiec 2023-09-03 22:40:10 +02:00
parent 61b0d6ad9c
commit 5ba3d8f2b3

14
svr.js
View file

@ -4032,6 +4032,13 @@ if (!cluster.isPrimary) {
return; return;
} }
// Check for invalid X-Forwarded-For header
if(!isForwardedValid) {
serverconsole.errmessage("X-Forwarded-For header is invalid.");
callServerError(400);
return;
}
// Sanitize URL // Sanitize URL
var sanitizedHref = sanitizeURL(href); var sanitizedHref = sanitizeURL(href);
@ -4068,13 +4075,6 @@ if (!cluster.isPrimary) {
return; return;
} }
} }
// Check for invalid X-Forwarded-For header
if(!isForwardedValid) {
serverconsole.errmessage("X-Forwarded-For header is invalid.");
callServerError(400);
return;
}
// Handle redirects to HTTPS // Handle redirects to HTTPS
if(secure && !fromMain && !disableNonEncryptedServer && !disableToHTTPSRedirect) { if(secure && !fromMain && !disableNonEncryptedServer && !disableToHTTPSRedirect) {