Skip to content
Snippets Groups Projects
Commit 4e1ae2b1 authored by Rob Di Marco's avatar Rob Di Marco
Browse files

parse out as HTTP_X_FORWARDED_FOR as a comma separated list and ignore proxies

parent e1b6d887
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ module Geocoder
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
@location = Geocoder.search(env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/)[0]).first
else
@location = Geocoder.search(ip).first
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