Can i get a remote client's ip?

i want get a remote clients ip, so i used express req.ip but i only getting :ffff:127.0.0.1
so i used x-forwarded-for but i only getting weird string

req.headers[‘x-forwarded-for’] || req.connection.remoteAddress

Just a reminder that if you’re going to be storing IP addresses from people who visit your site, you’ll also need to think about security measures for keeping that data safe!

Also worth mentioning that IP Addresses are considered to be personal data, personal data should be well protected! https://gdpr-info.com/dynamic-ip-addresses-personal-data/

The ruling means that data owners may need to tighten up even further their consent policies on websites.

1 Like

The “weird string” you are talking about is likely a IPv6 address, this is totally normal since the world is running out of IPv4 addresses. Some ISPs handout IPv6 addresses whilst others hand out IPv4 addresses.

1 Like