Skip to content
Snippets Groups Projects
Commit f67defd8 authored by Konstantin Krauss's avatar Konstantin Krauss
Browse files

Adding support for HTTP_X_FORWARDED_FOR too

parent 1eca628e
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,8 @@ module Geocoder ...@@ -7,6 +7,8 @@ module Geocoder
unless defined?(@location) unless defined?(@location)
if env.has_key?('HTTP_X_REAL_IP') if env.has_key?('HTTP_X_REAL_IP')
@location = Geocoder.search(env['HTTP_X_REAL_IP']).first @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 else
@location = Geocoder.search(ip).first @location = Geocoder.search(ip).first
end 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