[help] My header parser is working, but contains too much data

Here is my request header parser, but it’s got way too much data compared to the example project:
https://infinite-shore-85880.herokuapp.com/api/whoami

Is that the point that I need to further parse the headers to reduce the text an just show a snippet?

My IP address is showing up totally different as well even from the same connection. I’m not using http, I’m just using express.

here is my git hub:

Thanks for any help!

You might like to check out user agent parser modules you can install from npm. I used one that made it a bit easier…

Thank you! I guess that’s part of learning this craft…using and finding libraries.

This one looks cool
https://faisalman.github.io/ua-parser-js/

any recommendations about the ip part? This is what it looks like locally
{
ipaddress: “::1”,
language: “en-US,en;q=0.8”,
software: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36”
}

and from my heroku app:

{
ipaddress: "::ffff:10.71.223.81",
language: "en-US,en;q=0.8",
software: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"
}

but when I use the example project it looks like this:
{
ipaddress: “198.184.147.58”,
language: “en-US”,
software: “Macintosh; Intel Mac OS X 10_11_6”
}

I am working form behind a firewall at a hospital (don’t worry, no one is dying!), but b/c I’m seeing a ‘normal’ IP address in one version and a weird version in my code, I’m wondering what’s up with that. I’m simply using req.ip in express to get my IP address.

Thanks again, you’re a big help…just enough info to keep me moving forward.

Also I found this:
https://www.npmjs.com/package/request-ip

Not sure how much different it is than the express req.ip, but it does mention something about “using” ip4 vs using ip6…how do I decide what I’m “using”? I’ve only just learned about those tonight!

I had the same IPv6 problem when I did it. I can’t remember the exact solution now as it was a while ago, but I found the answer on Stack Overflow.