Method: ActionDispatch::Request#local?

Defined in:
lib/action_dispatch/http/request.rb

#local?Boolean

True if the request came from localhost, 127.0.0.1, or ::1.

Returns:

  • (Boolean)


473
474
475
# File 'lib/action_dispatch/http/request.rb', line 473

def local?
  LOCALHOST.match?(remote_addr) && LOCALHOST.match?(remote_ip)
end