module Rack::Request::Helpers

Public Instance Methods

trusted_proxy?(ip) click to toggle source
# File lib/rack-custom-proxies.rb, line 20
def trusted_proxy?(ip)
  Rack::Request.trusted_proxies.each do |tp|
    begin
      return true if tp.include?(ip)
    rescue IPAddr::InvalidAddressError
      # If we get an invalid address, we can just ignore it
      # and check the next one
    end
  end
  false
end