Clifford Heath wrote:
> Stewart wrote:
>> whats the best way to get a client ip address. I am using rails if that
>> makes any difference
> 
> It does - you need the socket, and if you're in a Mongrel hiding behind
> an Apache or IIS you're out of luck. Otherwise, BasicSocket::getpeeraddr
> is what you want - then you have to parse the sockaddr structure in a
> platform-dependent way. Blech - why can't Ruby do basic sockets right?

If you're please behind a mongrel cluster you can use

request.env['HTTP_X_FORWARDED_FOR'].split(", ")

the first element in the resultant array should be the originating 
client IP address


-- 
Posted via http://www.ruby-forum.com/.