Redirecting to subdomain based on geolocation country and continent


#1

Whats the best way to hard redirect a user to a subdomain based on client.geo.country_code and client.geo.continent_code value?

I’m working on a site that is going to have 3 sub domains with users getting geofenced to a particular subdomain depending on whether they are from the UK (client.geo.country_code == “GB”), EU (client.geo.continent_code == “EU”) or ROW.

The subdomains are going to be as follows:

www.domain.com = GB
eu.domain.com = EU
world.domain.com = ROW

My access to Fastly is only via the API and I’m going to have to use VCL snippets pushed to the account via the CMS.