How Can I Get The User's Ip-address In My Cloud-run Flask App?
I have a Flask app running via Google Cloud Run and I need to know the user's IP-Address. I am using gunicorn as my Server. I have tried the following code: request.remote_addr req
Solution 1:
You have headers provided by Google. In my tests I got these 2:
X-Forwarded-For: [MyPubliCIp, LoadBalancerIp,MyPubliCIp]Forwarded: [for="MyPubliCIp";proto=http]
Use them as you want.
Post a Comment for "How Can I Get The User's Ip-address In My Cloud-run Flask App?"