diff options
author | lookatmike <cisephys@gmail.com> | 2016-07-31 22:36:11 +0300 |
---|---|---|
committer | lookatmike <cisephys@gmail.com> | 2016-07-31 22:36:11 +0300 |
commit | ae108ff703a8b9e73f2a260806c89eccac5a6cf6 (patch) | |
tree | c955b4dbdee3537495e9a80caaaddbad667aeaec /config/initializers | |
parent | e299504b798c053817f1c866649542ac0c779924 (diff) |
Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured.
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/trusted_proxies.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb index 30770b71e24..cd869657c53 100644 --- a/config/initializers/trusted_proxies.rb +++ b/config/initializers/trusted_proxies.rb @@ -7,6 +7,8 @@ module Rack class Request def trusted_proxy?(ip) Rails.application.config.action_dispatch.trusted_proxies.any? { |proxy| proxy === ip } + rescue IPAddr::InvalidAddressError + false end end end |