lib/rack/request.rb in rack-2.0.6 vs lib/rack/request.rb in rack-2.0.7
- old
+ new
@@ -259,10 +259,10 @@
return remote_addrs.first if remote_addrs.any?
forwarded_ips = split_ip_addresses(get_header('HTTP_X_FORWARDED_FOR'))
- return reject_trusted_ip_addresses(forwarded_ips).last || get_header("REMOTE_ADDR")
+ return reject_trusted_ip_addresses(forwarded_ips).last || forwarded_ips.first || get_header("REMOTE_ADDR")
end
# The media type (type/subtype) portion of the CONTENT_TYPE header
# without any media type parameters. e.g., when CONTENT_TYPE is
# "text/plain;charset=utf-8", the media-type is "text/plain".