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 via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 25, 2011, at 8:31 AM, Phoenix Rising wrote:> 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 :-)I just ran afoul of this when trying to pay my insurance bill. The poorly-written sniffer on the insurance company''s national /paybill page looked up my IP, and discovered I''m in New York (I''m actually near Philadelphia) and redirected me to a "sorry, we don''t do business in your area" page. My T1 must route through New York, I guess. Luckily Google was able to find the real payment page. Walter -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Feb 25, 2011 at 3:38 AM, Tushar Gandhi <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> For my upcoming application I need to find the location of the user. > I am doing this by using the "GeoIp" plugin.As others have pointed out, this is pretty unreliable. My home-based IP maps to a location several counties (~60 miles) away from where I actually live. And while on the road using a Verizon MiFi card, my location was identified as somewhere on the East Coast, when I was actually in a moving vehicle crossing the salt flats in the state of Utah :-) Depending on your need for accuracy, you may also want to look into the newer HTML5 location api as a cross-check. <http://dev.w3.org/geo/api/spec-source.html> HTH, and good luck! -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.