diff options
author | Andre Arko <andre@arko.net> | 2011-11-16 12:49:15 -1000 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2011-11-16 12:54:18 -1000 |
commit | 5621abd5698536f1676306930f6aef105d7ae6dc (patch) | |
tree | 6ba22b30123e7d405e6142120d87e9cbb71b1e18 /actionpack/lib | |
parent | f05ccf805a6d2a3ed73ef9928577e8b0ebbb3c49 (diff) | |
download | rails-5621abd5698536f1676306930f6aef105d7ae6dc.tar.gz rails-5621abd5698536f1676306930f6aef105d7ae6dc.tar.bz2 rails-5621abd5698536f1676306930f6aef105d7ae6dc.zip |
:facepalm: Request#remote_ip has to work without the middleware
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/remote_ip.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 0e8bd0bd6d..4e6feb708e 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -155,9 +155,9 @@ module ActionDispatch @ip ||= super end - # Originating IP address from the RemoteIp middleware. + # Originating IP address, usually set by the RemoteIp middleware. def remote_ip - @remote_ip ||= @env["action_dispatch.remote_ip"] + @remote_ip ||= @env["action_dispatch.remote_ip"] || ip end # Returns the unique request id, which is based off either the X-Request-Id header that can diff --git a/actionpack/lib/action_dispatch/middleware/remote_ip.rb b/actionpack/lib/action_dispatch/middleware/remote_ip.rb index 77aa4e743e..3a88f2ca43 100644 --- a/actionpack/lib/action_dispatch/middleware/remote_ip.rb +++ b/actionpack/lib/action_dispatch/middleware/remote_ip.rb @@ -58,7 +58,7 @@ module ActionDispatch not_proxy = client_ip || forwarded_ips.last || remote_addrs.first # Return first REMOTE_ADDR if there are no other options - not_proxy || ips_from('REMOTE_ADDR', :all).first + not_proxy || ips_from('REMOTE_ADDR', :allow_proxies).first end def to_s |