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;
}
// 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);
@ -4069,13 +4076,6 @@ if (!cluster.isPrimary) {
}
}
// 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) {
var hostx = req.headers.host;