diff --git a/svr.js b/svr.js index 4c40707..3a21f91 100644 --- a/svr.js +++ b/svr.js @@ -4032,6 +4032,13 @@ if (!cluster.isPrimary) { return; } + // Check for invalid X-Forwarded-For header + if(!isForwardedValid) { + serverconsole.errmessage("X-Forwarded-For header is invalid."); + callServerError(400); + return; + } + // Sanitize URL var sanitizedHref = sanitizeURL(href); @@ -4068,13 +4075,6 @@ if (!cluster.isPrimary) { 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 if(secure && !fromMain && !disableNonEncryptedServer && !disableToHTTPSRedirect) {