🤦 Request#remote_ip has to work without the middleware

This commit is contained in:
Andre Arko 2011-11-16 12:49:15 -10:00
parent f05ccf805a
commit 5621abd569
2 changed files with 3 additions and 3 deletions

View File

@ -155,9 +155,9 @@ module ActionDispatch
@ip ||= super
end
# Originating IP address from the RemoteIp middleware.
# Originating IP address, usually set by the RemoteIp middleware.
def remote_ip
@remote_ip ||= @env["action_dispatch.remote_ip"]
@remote_ip ||= @env["action_dispatch.remote_ip"] || ip
end
# Returns the unique request id, which is based off either the X-Request-Id header that can

View File

@ -58,7 +58,7 @@ module ActionDispatch
not_proxy = client_ip || forwarded_ips.last || remote_addrs.first
# Return first REMOTE_ADDR if there are no other options
not_proxy || ips_from('REMOTE_ADDR', :all).first
not_proxy || ips_from('REMOTE_ADDR', :allow_proxies).first
end
def to_s