From: Eugen Rochko Date: Sun, 22 Jan 2017 20:01:28 +0000 (+0100) Subject: Override Rack::Request to use the same trusted proxy settings as Rails X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=61aee0006eec95f47ca0a0c75f3ccf4151516b4a;p=mastodon.git Override Rack::Request to use the same trusted proxy settings as Rails --- 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