How to get the IP form the client

Well… I tried with my phone to my local ip, and request.ip works. But if im using a proxy (like ngrok) it shows localhost, I dont know why