diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-01-22 21:01:28 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-01-22 21:01:28 +0100 |
commit | 61aee0006eec95f47ca0a0c75f3ccf4151516b4a (patch) | |
tree | 77eb259a6863f9996f5344bb846215d89733fe13 /config | |
parent | 67befe546342c58f1a16bdb08b6a2ef438e83d57 (diff) |
Override Rack::Request to use the same trusted proxy settings as Rails
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/trusted_proxies.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb new file mode 100644 index 000000000..27e9ee039 --- /dev/null +++ b/config/initializers/trusted_proxies.rb @@ -0,0 +1,7 @@ +module Rack + class Request + def trusted_proxy?(ip) + Rails.application.config.action_dispatch.trusted_proxies.any? { |proxy| proxy === ip } + end + end +end |