What I am doing
I have a flask website and I am making it accessible to a client using ngrok tunneling.
What I want
I am trying to get the IP address of the client.
What I have done so far
I have tried these so far,
request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
and
request.environ['REMOTE_ADDR']
But both of them are returning 127.0.0.1. I have also checked out this question But it didn't help me out since the answer written there are for getting client IP's in production server environment whereas I am looking for any method using which I can get IP address of client in the development mode of server which is tunneled using ngrok.
I have two possible methods in my mind,
- If I can get the IP address of the connection requester from Ngrok. I don't know is there any way to do it but this can solve my problem.
- Or I add something to my javascript code so that whenever the index page loads up it sends an ajax request to the server telling it the IP address of the client. (Correct me if wrong)