about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-22 21:01:28 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-22 21:01:28 +0100
commit61aee0006eec95f47ca0a0c75f3ccf4151516b4a (patch)
tree77eb259a6863f9996f5344bb846215d89733fe13 /config
parent67befe546342c58f1a16bdb08b6a2ef438e83d57 (diff)
Override Rack::Request to use the same trusted proxy settings as Rails
Diffstat (limited to 'config')
-rw-r--r--config/initializers/trusted_proxies.rb7
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