Hey Tushar,

Try changing HTTP_X_FORWARDED_FOR to REMOTE_ADDR.  The second one of
those is what will give you the user's IP address.  Bear in mind that
if they're behind a proxy, you'll get the IP address of that proxy
instead of theirs, but then again, that's one of the points of their
using a proxy to begin with :-)

Good luck!

On Feb 25, 4:38 am, Tushar Gandhi <[email protected]> wrote:
> Hi,
> For my upcoming application I need to find the location of the user.
> I am doing this by using the "GeoIp" plugin.
> For geoIp I have to find the IP address of the incoming request.
> I have written the code to get the IP address:-
> "client_ipaddress=request.env["HTTP_X_FORWARDED_FOR"] ||
> request.remote_addr"
> But it is giving me the IP address of the machine. Is it right?
> If yes then how the GeoIp will find the location of the machine.
> I have tried some online demo's which actually detect the IP address of
> the router and depending on that they are finding the location.
>
> Can anyone tell me Am I on right path?
>
> Thanks,
> Tushar
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to