Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

geolocation of an IP address while using GAE sdk or otherwise

I have hosted my web-app on google appengine (GAE). Does GAE sdk offer any way to find the geolocation of an IP ? If yes please suggest how can I do this .

like image 371
Y.E.P Avatar asked Sep 12 '12 11:09

Y.E.P


1 Answers

Yes, you can use request headers to get the geolocation of the IP.

https://cloud.google.com/appengine/docs/standard/go/reference/request-response-headers#app_engine-specific_headers

X-AppEngine-Country Country from which the request originated, as an ISO 3166-1 alpha-2 country code. App Engine determines this code from the client's IP address.

Other headers that are useful for location are X-AppEngine-Region, X-AppEngine-City and X-AppEngine-CityLatLong

I don't think this will return valid values when running on your local sdk.

like image 55
Rob Curtis Avatar answered Oct 11 '22 21:10

Rob Curtis