local?()
True if the request came from localhost, 127.0.0.1, or ::1.
# File actionpack/lib/action_dispatch/http/request.rb, line 428 def local? LOCALHOST.match?(remote_addr) && LOCALHOST.match?(remote_ip) end