geocoding api not responding fast enough for IP address

后端 未结 3 1822
野性不改
野性不改 2020-12-21 23:15

In my production server I\'ve used the Geocoder gem. But, the following code not working in the server console.

Geocoder.search(\"192.168.1.4\")
相关标签:
3条回答
  • 2020-12-21 23:20

    I think it is an issue with freegeoip, try the following:

    Enter this in your rails console:

    Geocoder.configure(:ip_lookup => :telize)

    Now try you search in your console.

    if this works you can have your 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
    
    )
    

    I hope this help you.

    0 讨论(0)
  • I get this error when i am not connected to the internet..pls verify that you have an active internet or you are bypassing the proxy.

    0 讨论(0)
  • 2020-12-21 23:40

    Have you tried using your Public facing IP instead of the internal IP you are using?

    IP address geocoding often returns results for the organization which owns the IP address block instead of the actual computer IP address. This is because IP address geocoding does not consider private IPs, VPNs, or internal network blocks.

    0 讨论(0)
提交回复
热议问题