diff options
Diffstat (limited to 'config/initializers/trusted_proxies.rb')
-rw-r--r-- | config/initializers/trusted_proxies.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb new file mode 100644 index 000000000..3c2afd8cd --- /dev/null +++ b/config/initializers/trusted_proxies.rb @@ -0,0 +1,11 @@ +module Rack + class Request + def trusted_proxy?(ip) + if Rails.application.config.action_dispatch.trusted_proxies.nil? + super + else + Rails.application.config.action_dispatch.trusted_proxies.any? { |proxy| proxy === ip } + end + end + end +end |