diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-11-15 22:47:18 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-11-15 22:47:18 +0000 |
commit | 8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f (patch) | |
tree | 662be22f6fe091499390b3ea9e0b0fda3a9f715c /actionpack/lib/action_dispatch/middleware | |
parent | 6491aadc525b8703708e0fd0fbf05bd436a47801 (diff) | |
download | rails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.tar.gz rails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.tar.bz2 rails-8d1a2b3ecde5a8745b3eaab4763a71d80ca3441f.zip |
Revert "Merge pull request #3640 from indirect/remote_ip"
This reverts commit 6491aadc525b8703708e0fd0fbf05bd436a47801, reversing
changes made to 83bf0b626cf2134260903e57d74f67de57384073.
See https://github.com/rails/rails/pull/3640#issuecomment-2752761 for
explanation.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/remote_ip.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/remote_ip.rb b/actionpack/lib/action_dispatch/middleware/remote_ip.rb index 77aa4e743e..ee0d19a50d 100644 --- a/actionpack/lib/action_dispatch/middleware/remote_ip.rb +++ b/actionpack/lib/action_dispatch/middleware/remote_ip.rb @@ -55,10 +55,7 @@ module ActionDispatch "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}" end - 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 + client_ip || forwarded_ips.last || remote_addrs.first end def to_s @@ -69,9 +66,9 @@ module ActionDispatch protected - def ips_from(header, allow_proxies = false) + def ips_from(header) ips = @env[header] ? @env[header].strip.split(/[,\s]+/) : [] - allow_proxies ? ips : ips.reject{|ip| ip =~ @middleware.proxies } + ips.reject{|ip| ip =~ @middleware.proxies } end end |