Add custon debug var

This commit is contained in:
2026-05-09 14:15:59 -03:00
parent 101842a713
commit a66fc3b760
+4
View File
@@ -327,6 +327,9 @@ function safeIds(ids) {
function clientIp(req) {
if (process.env.TRUST_PROXY === 'true') {
const edgeClientIp = String(req.headers['x-bitsforfree-client-ip'] || '').trim();
if (edgeClientIp) return edgeClientIp;
const forwarded = String(req.headers['x-forwarded-for'] || '').split(',')[0].trim();
if (forwarded) return forwarded;
}
@@ -339,6 +342,7 @@ function clientIpDebug(req) {
resolvedClientIp: clientIp(req),
remoteAddress: req.socket.remoteAddress || '',
headers: {
xBitsForFreeClientIp: req.headers['x-bitsforfree-client-ip'] || '',
xForwardedFor: req.headers['x-forwarded-for'] || '',
xRealIp: req.headers['x-real-ip'] || '',
forwarded: req.headers.forwarded || '',