fix ip getter

This commit is contained in:
Sergei Meza 2022-10-18 15:38:21 +09:00
parent d0f5c6dec7
commit 0336f41e12
2 changed files with 25 additions and 58 deletions

View file

@ -45,7 +45,8 @@ export async function getSession(req) {
throw new Error(`Website not found: ${website_uuid}`);
}
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const { userAgent, browser, os, country, device } = await getClientInfo(req, payload);
let session_uuid = uuid(websiteId, hostname, ip, userAgent);
if (process.env.CROSSDOMAIN_TRACKING) {