Skip to content
Snippets Groups Projects
Commit da364196 authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #341 from konsti/master

Support for X_REAL_IP and X_FORWARDED_FOR
parents 22d3fc19 f67defd8
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,13 @@ module Geocoder
def location
unless defined?(@location)
@location = Geocoder.search(ip).first
if env.has_key?('HTTP_X_REAL_IP')
@location = Geocoder.search(env['HTTP_X_REAL_IP']).first
elsif env.has_key?('HTTP_X_FORWARDED_FOR')
@location = Geocoder.search(env['HTTP_X_FORWARDED_FOR']).first
else
@location = Geocoder.search(ip).first
end
end
@location
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment