Add custon debug var
This commit is contained in:
@@ -327,6 +327,9 @@ function safeIds(ids) {
|
|||||||
|
|
||||||
function clientIp(req) {
|
function clientIp(req) {
|
||||||
if (process.env.TRUST_PROXY === 'true') {
|
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();
|
const forwarded = String(req.headers['x-forwarded-for'] || '').split(',')[0].trim();
|
||||||
if (forwarded) return forwarded;
|
if (forwarded) return forwarded;
|
||||||
}
|
}
|
||||||
@@ -339,6 +342,7 @@ function clientIpDebug(req) {
|
|||||||
resolvedClientIp: clientIp(req),
|
resolvedClientIp: clientIp(req),
|
||||||
remoteAddress: req.socket.remoteAddress || '',
|
remoteAddress: req.socket.remoteAddress || '',
|
||||||
headers: {
|
headers: {
|
||||||
|
xBitsForFreeClientIp: req.headers['x-bitsforfree-client-ip'] || '',
|
||||||
xForwardedFor: req.headers['x-forwarded-for'] || '',
|
xForwardedFor: req.headers['x-forwarded-for'] || '',
|
||||||
xRealIp: req.headers['x-real-ip'] || '',
|
xRealIp: req.headers['x-real-ip'] || '',
|
||||||
forwarded: req.headers.forwarded || '',
|
forwarded: req.headers.forwarded || '',
|
||||||
|
|||||||
Reference in New Issue
Block a user