I try to determine the external IP, if someone is accessing a device using public URL.
However, the IP I receive (using nodejs) is (in my example): 18.104.22.168
Which is an IP address owned by Amazon, and not the external IP of the client accessing the remote device.
Is there a possibility to receive the real external IP of the client?
@fritz can you provide the snippet of nodejs code you are using to get the IP address?
req.clientIp.split(":")[req.clientIp.split(":").length - 1]
in the HTTP Request handler (using express) to obtain the IPv4 address.
Hello @fritz did you try to use the
PUBLIC IP ADDRESS published on balenaCloud? Having said that, it’s possible that the public ip address is not accessible due modems security reasons.
no, as stated, we cannot use the public IP address due to network / modem security.
We need to find out the real client IP when using the public url.
Hello, it may not be possible to obtain the client’s IP due to the way the Public URL feature works. I am also experimenting with this as well though, and
req.headers['x-forwarded-for'] is empty unfortunately.
Any other hints?
The accepted answer in the link above worked for me to get the actual client IP on a local network, but no luck so far using the Public URL. I’m still discussing with our back end team to find out definitively if this is possible.
@alanb128 Thanks. Please let me know, if you can get a solution with the back-end team!
Hello @fritz unfortunately the current configuration of our Public URL does not pass the client information. We’re looking into options for changing that but I have no ETA at this point. We will keep this thread updated with any new information.