Using request.env['REMOTE_HOST']

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!

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs