actionpack-3.0.3/lib/action_dispatch/http/request.rb:
LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze
All IPv4 127.x.x.x addresses are loopback/localhost addresses.
127.0.0.0 is a Class A /8 network.
This code should be:
LOCALHOST = [/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze
Not sure if this issue exists elsewhere in Rails 3.
Citations:
http://www.faqs.org/rfcs/rfc1700.html:
"Special Addresses"
(g) {127, <any>}
Internal host loopback address. Should never appear outside
a host.
http://www.faqs.org/rfcs/rfc3330.html
127.0.0.0/8 - This block is assigned for use as the Internet host
loopback address. A datagram sent by a higher level protocol to an
address anywhere within this block should loop back inside the host.
This is ordinarily implemented using only 127.0.0.1/32 for loopback,
but no addresses within this block should ever appear on any network
anywhere [RFC1700, page 5].
ifconfig lo:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host