Method: Geocoder::Request#safe_location

Defined in:
lib/geocoder/request.rb

#safe_locationObject

This safe_location() protects you from trivial IP spoofing.

For requests that go through a proxy that you haven't
whitelisted as trusted in your Rack config, you will get the
location for the IP of the last untrusted proxy in the chain,
not the original client IP.  You WILL NOT get the location
corresponding to the original client IP for any request sent
through a non-whitelisted proxy.


21
22
23
# File 'lib/geocoder/request.rb', line 21

def safe_location
  @safe_location ||= Geocoder.search(ip, ip_address: true).first
end