Using request.env['REMOTE_HOST']


#1

Hi,

I’m currently using request.env[‘REMOTE_HOST’] to pull back the remote
users IP address. This worked fine in development (and production) under
Webrick but when I tried to use it with mongrel, it kicked back an
error.

Is there a more appropriate way to find out the remote users IP address?

Thanks in advance!


#2

Pete wrote:

I’m currently using request.env[‘REMOTE_HOST’] to pull back the remote
users IP address. This worked fine in development (and production) under
Webrick but when I tried to use it with mongrel, it kicked back an
error.

Is there a more appropriate way to find out the remote users IP address?

request.remote_ip() -
http://api.rubyonrails.com/classes/ActionController/AbstractRequest.html#M000175