I am writing a serverless function on IBM Cloud; my code needs to take actions based on remote IP, filtering requests by country. How can I obtain connection details, such Express req.ip
or Node request.connection.remoteAddress
?
CodePudding user response:
I contacted IBM Cloud support about this recently. They said it wasn't supported yet.
While testing Cloud Functions, I wanted to check if I could use the IP address of the client to do geolocation. This is a use case I have at my work (we don't use IBM Cloud right now, we use GKE). I noticed by making a test function that I was able to log the headers when I made it a web action. I noticed that there were two headers that appeared to contain the IP address of the client (my web browser), but it's not the right IP. My IP right now is ... but the headers X-Forwarded-For and X-Real-IP contained the IP 172.70.130.199, according to the logs in LogDNA.
Their reply:
Thank you for your patience and functions team confirmed this is not supported yet, and this has been submitted to dev team to review to add to the dev pipeline. Sorry for your inconvenience and feel free to let us know if you have more concerns.