class ActionDispatch::RemoteIp - actionpack-3.2.22 Documentation

# class ActionDispatch::RemoteIp

### Constants

TRUSTED_PROXIES

  IP addresses that are “trusted proxies” that can be stripped from the comma-delimited list in the X-Forwarded-For header. See also: en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces

### Attributes

check_ip[R]
proxies[R]

### Public Class Methods

new(app, check_ip_spoofing = true, custom_proxies = nil) click to toggle source

    # File lib/action_dispatch/middleware/remote_ip.rb, line 18
    def initialize(app, check_ip_spoofing = true, custom_proxies = nil)
      @app = app
      @check_ip = check_ip_spoofing
      if custom_proxies
        custom_regexp = Regexp.new(custom_proxies)
        @proxies = Regexp.union(TRUSTED_PROXIES, custom_regexp)
      else
        @proxies = TRUSTED_PROXIES
      end
    end

### Public Instance Methods

call(env) click to toggle source

    # File lib/action_dispatch/middleware/remote_ip.rb, line 29
    def call(env)
      env["action_dispatch.remote_ip"] = GetIp.new(env, self)
      @app.call(env)
    end