From f67defd8d2b25511023be21c318aef42562058b2 Mon Sep 17 00:00:00 2001 From: Konstantin Krauss <konstantin@propertybase.com> Date: Thu, 29 Nov 2012 18:48:11 +0100 Subject: [PATCH] Adding support for HTTP_X_FORWARDED_FOR too --- lib/geocoder/request.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/geocoder/request.rb b/lib/geocoder/request.rb index fe8286b5..3e1dbc82 100644 --- a/lib/geocoder/request.rb +++ b/lib/geocoder/request.rb @@ -7,6 +7,8 @@ module Geocoder unless defined?(@location) 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 -- GitLab