Getting IPv6 instead of IPv4 and understanding IP related properties in the req object

Tell us what’s happening:
I got 2 issues here:

  • Issue1: I don’t know how I can display the IPv6 instead of IPv4 in this exercice. The example given at succeeds in doing so, but I can’t get the same and the only ipaddress I get is the IPv4
  • Issue 2: I had to “Google” my way through this, especially for the ip part. I was (and still am) super confused with all the options for getting the ip:
    • req.ip
    • req.ips (supposedly an array
      -req.header[‘x-forwarded-for’] (which actually doesn’t work) or req.headers[‘x-forwarded-for’] (which work)

Overall I passed the challenge, but I don’t fully understand why and it’s very frustrating. Any comprehensive literature on the topic would help a ton :pray:

Your project link(s)

github: Header-Parser-Microservercice/server.js at main · JossMilon/Header-Parser-Microservercice · GitHub

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36

Challenge: Request Header Parser Microservice

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.