I am writing a Node.Js server, I uploaded it to Heroku,
I'm using IPs to make a temporary cart for each user (device),
I want to distinct also every device in the same network,
I mean I want to make a cart for every user, (also in the same IP)
I tried to use mac address but it's getting the host mac address(the Heroku mac address).
I need the local device mac address
What I have tried:
let ip;
let ipAddr = req.headers['x-forwarded-for'];
if (ipAddr) {
var list = ipAddr.split(",");
ip = list[list.length - 1];
} else {
ip = req.socket.remoteAddress;
}
const ipFoundOrNot = await IP.findOne({ postIP: ip });
IP is my Model Schema, I want to find also a computer name or something else better to distinguish also users in the same network,
I mean by that something like this...
let computerName = process.env.COMPUTERNAME;
const ipFoundOrNot = await IP.findOne({ postIP: ip,computerName:computerName });
But when I do process.env.COMPUTERNAME I get undefined in node js in heroku...
I also tried to get the device mac address, it works fine in localhost, But when I apply it to heroku, it's getting the mac address of the heroku server..