Or just

request.env.ip

http://rack.rubyforge.org/doc/classes/Rack/Request.src/M000288.html

On Oct 2, 11:55 am, Peter van Hardenberg <[email protected]> wrote:
> I use this in my code -- I run my apps at foo.heroku.com with whatever
> the ghetto SSL option is, so YMMV.
>
> def remote_ip
>       if forwarded = request.env["HTTP_X_FORWARDED_FOR"]
>         forwarded.split(",").first
>       elsif addr = request.env["REMOTE_ADDR"]
>         addr
>       end
> end
>
> -pvh
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to