mirror of https://github.com/rails/rails
🤦 Request#remote_ip has to work without the middleware
This commit is contained in:
parent
f05ccf805a
commit
5621abd569
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue