Search code examples
phpamazon-web-servicesgeolocationipamazon-cloudfront

Presenting visitors with regional content (province/state/county), amazon AWS


I am looking for a automatic way to link a website visitors's location to regionally limited content (not based on distance from lat/lon). The content is generated by a static site generator for each countries' province and will be delivered to the user from Amazon AWS. (Cloudfront I guess, we haven't yet decided precisely) provinces will each have their own static directory and for instance be accessed through their own url (//province.website.country)

So for instance a visitor from Beieren, Germany, must see only content that is published to Beieren, when the enter "website.de", get redirected to the beieren sub-url.

A possible solution is to present the user with a map in which they click on their region. However, we prefer to do this automatically when the information is present in the request headers/ip info.

I wonder what methods are out there except from comparing huge lists of ip ranges to ip/location databases and then getting the province from that location. For instance we are willing to use perverted methods like requesting google user data. But perhaps Amazon AWS provides a way to do this. We haven't been able to find it.

Most of all, we are looking for the fastest and most reliable way.


Solution

  • AWS does not provide any method of doing this.

    Further, without asking the user where they are you generally have to rely on their IP address which is only really accurate in giving you the location of their ISP. I've seen IP address based geolocation be wildly inaccurate, so I wouldn't rely on it for anything important. If a user is on a mobile device you might be able to request GPS coordinates, but the user could always deny that request.