Geocoding api not responding fast enough for IP address

In my production server, I used the Geocoder gem. But the following code does not work in the server console.

Geocoder.search("192.168.1.4") 

I configured the geocoder.rb file with a timeout of 30 seconds. But still it gives a geocoding error api not responding fast enough

Surprisingly, whenever I ran Geocoder.search("San Francisco, CA") , it gave a result for a few seconds.

What should I do?

+1
source share
3 answers

I think this is a problem with freegeoip, try the following:

Enter this into the rails console:

Geocoder.configure (: ip_lookup =>: telize)

Now try searching in the console.

if this works, you can have your own file (config / initializers / geocoder.rb)

 Geocoder.configure( :timeout=>20, :lookup=>:yandex, :ip_lookup=>:telize, :language=>:en, :http_headers=>{}, :use_https=>false, :http_proxy=>nil, :https_proxy=>nil, :api_key=>nil, :cache=>nil, :cache_prefix=>"geocoder:", :units=>:km, :distances=>:linear ) 

Hope this helps you.

+1
source

Have you tried using your public IP address instead of the internal IP address you are using?

Geocoding IP addresses often returns results for an organization that owns a block of IP addresses instead of the actual IP address of the computer. This is because geocoding IP addresses does not take into account private IP addresses, virtual private networks, or internal network blocks.

0
source

I get this error when I am not connected to the internet. Make sure you have active internet or bypass proxies.

0
source

All Articles