Methods
C
N
Classes and Modules
Constants
TRUSTED_PROXIES = %r{ ^127\.0\.0\.1$ | # localhost ^(10 | # private IP 10.x.x.x 172\.(1[6-9]|2[0-9]|3[0-1]) | # private IP in the range 172.16.0.0 .. 172.31.255.255 192\.168 # private IP 192.168.x.x )\. }x
 

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
[R] check_ip
[R] proxies
Class Public methods
new(app, check_ip_spoofing = true, custom_proxies = nil)
    # File actionpack/lib/action_dispatch/middleware/remote_ip.rb, line 18
18:     def initialize(app, check_ip_spoofing = true, custom_proxies = nil)
19:       @app = app
20:       @check_ip = check_ip_spoofing
21:       if custom_proxies
22:         custom_regexp = Regexp.new(custom_proxies)
23:         @proxies = Regexp.union(TRUSTED_PROXIES, custom_regexp)
24:       else
25:         @proxies = TRUSTED_PROXIES
26:       end
27:     end
Instance Public methods
call(env)
    # File actionpack/lib/action_dispatch/middleware/remote_ip.rb, line 29
29:     def call(env)
30:       env["action_dispatch.remote_ip"] = GetIp.new(env, self)
31:       @app.call(env)
32:     end