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 .
Yes, you can use request headers to get the geolocation of the IP.
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.
It is not clear from your question if you want to determine location of the http request being made to your GAE application or whether you want a service on GAE that can give you the geolocation of any IP address.
GAE provides support for certain HTTP headers that contain geolocation information like country, city, region and IP address. Refer to the two articles over here for more details:
- http://www.rominirani.com/2012/04/25/appengine-location-detection-update-x-appengine-country-and-more/
- http://www.rominirani.com/2011/07/11/x-appengine-country-http-header-google-app-engine/
The above articles discuss the headers like
- X-AppEngine-country
- X-AppEngine-Region
- X-AppEngine-City
- X-AppEngine-CityLatLong
If you are simply looking for a service to give you geolocation details based on IP then GAE does not provide that. There are various external web services available like the one mentioned above in one of the answers.
© 2022 - 2024 — McMap. All rights reserved.