1
0
Fork 0
forked from svrjs/svrjs

Add proxySafe flag to middleware.

This commit is contained in:
Dorian Niemiec 2024-08-25 12:37:14 +02:00
parent fb7c5ed854
commit 4b02efdeba
13 changed files with 27 additions and 0 deletions

View file

@ -710,6 +710,9 @@ function requestHandler(req, res) {
// Call the next middleware function // Call the next middleware function
const next = () => { const next = () => {
const currentMiddleware = middleware[index++]; const currentMiddleware = middleware[index++];
while (req.isProxy && currentMiddleware && !currentMiddleware.proxySafe) {
currentMiddleware = middleware[index++];
}
if (currentMiddleware) { if (currentMiddleware) {
try { try {
currentMiddleware(req, res, logFacilities, config, next); currentMiddleware(req, res, logFacilities, config, next);

View file

@ -51,3 +51,5 @@ module.exports.commands = {
} }
}, },
}; };
module.exports.proxySafe = true;

View file

@ -111,3 +111,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -37,3 +37,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -462,3 +462,5 @@ module.exports.commands = {
passCommand(args, log); passCommand(args, log);
}, },
}; };
module.exports.proxySafe = true;

View file

@ -32,3 +32,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
} }
}; };
module.exports.proxySafe = true;

View file

@ -79,3 +79,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -12,3 +12,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -153,3 +153,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}); });
}; };
module.exports.proxySafe = true;

View file

@ -990,3 +990,5 @@ module.exports = (req, res, logFacilities, config, next) => {
} }
}); });
}; };
module.exports.proxySafe = true;

View file

@ -134,3 +134,5 @@ module.exports = (req, res, logFacilities, config, next) => {
} }
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -52,3 +52,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;

View file

@ -140,3 +140,5 @@ module.exports = (req, res, logFacilities, config, next) => {
next(); next();
}; };
module.exports.proxySafe = true;