Open eebbesen opened 8 years ago
Clarify: I had said to use request.hostname
, but that's not a thing. request.remote_host
is just the ip.
I know that this can be done -- it logs requesting computer name when you are running a server with ruby -run -e httpd . -p 9090
.
I did some digging in webrick 2.2.0 -- not sure if we have access to this, but it looks like
request.params['u']
?For our purposes we may be able to use Resolv (http://ruby-doc.org/stdlib-2.2.2/libdoc/resolv/rdoc/Resolv.html#method-c-getname)
require 'resolv'
Resolv.getname(request.remote_ip)
I'm not sure that this will work outside of the network.
http://api.rubyonrails.org/classes/ActionDispatch/Request.html
offense.hostname