i want to get real ip address from user client when visit my website using rails in development mode?
but when i typing request.remote_ip
, i get ip address 127.0.0.1
??
how to get real ip address???
and when i try curl -H"X-Forwarded-For: 8.8.8.8" http://httpbin.org/ip
, i get my real ip address but when i try implements gem https://github.com/geokit/geokit-rails to get country based ip address... my ip it's not valid?
i try this :
IpGeocoder.geocode('my.real.ip.address')
and get error like this :
Geokit::Geocoders::GeocodeError: Geokit::Geocoders::GeocodeError
but if i try ip adrress from example :
IpGeocoder.geocode('12.215.42.19')
it's works
=> Provider: hostip
Street:
City: Aurora
State: TX
Zip:
Latitude: 33.0582
Longitude: -97.5159
Country: US
Success: true
whats wrong in my ip address? i get my real ip address from "curl -H"X-Forwarded-For: 8.8.8.8" http://httpbin.org/ip"
if i wrong plase tell me, thanks