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