LOG IN SIGN UP
Documentation

Geolocation-related VCL features

  Last updated October 18, 2017

Fastly exposes a number of geographic variables for you to take advantage of inside VCL for both IPv4 and IPv6 client IPs. These variables appear as follows:

Variable Description
client.geo.latitude The latitude associated with the IP address.
client.geo.longitude The longitude associated with the IP address.
client.geo.city The city or town name associated with the IP address, encoded using the ASCII character encoding (a lowercase ASCII approximation of the original string with diacritics removed).
client.geo.city.ascii An alias of client.geo.city.
client.geo.city.utf8 The city or town name associated with the IP address, encoded using the UTF-8 character encoding.
client.geo.continent_code A two-character code representing the continent associated with the IP address. Possible codes are: AF - Africa, AS - Asia, EU - Europe, NA - North America, OC - Oceania, SA - South America, AN - Antartica.
client.geo.country_code A two-character ISO 3166-1 country code for the country associated with the IP address. The US country code is returned for IP addresses associated with overseas United States military bases.
client.geo.country_code3 A three-character ISO 3166-1 alpha-3 country code for the country associated with the IP address. The USA country code is returned for IP addresses associated with overseas United States military bases.
client.geo.country_name The country name associated with the IP address, encoded using the ASCII character encoding (a lowercase ASCII approximation of the original string with diacritics removed).
client.geo.country_name.ascii An alias of client.geo.country_name.
client.geo.country_name.utf8 The country name associated with the IP address, encoded using the UTF-8 character encoding.
client.geo.postal_code The postal code associated with the IP address. These are available for some IP addresses in Australia, Canada, France, Germany, Italy, Spain, Switzerland, the United Kingdom, and the United States. We return the first 3 characters for Canadian postal codes. We return the first 2-4 characters (outward code) for postal codes in the United Kingdom.
client.geo.region The ISO 3166-2 region code associated with the IP address.
client.geo.area_code The telephone area code associated with the IP address. These are only available for IP addresses in the United States.
client.geo.metro_code The metro code associated with the IP address. Metro codes represent designated market areas (DMAs) in the United States and Germany, Independent Television Service (ITV) regions in the UK, department codes in France, South Korean administrative divisions (si, gun, gu or cities, counties, and districts), Chinese administrative regions (diji shi, or "region-level" cities), Russian federal districts, Norwegian municipalities, urban areas in New Zealand, and the Greater Capital City Statistical Area (GCCSA) and Significant Urban Areas (SUAs) in Australia.
client.geo.gmt_offset The time zone offset from coordinated universal time (UTC) for the client.geo.city associated with the IP address.
client.geo.conn_speed The type of connection speed associated with the IP address. Possible values are: broadband, cable, dialup, mobile, oc12, oc3, t1, t3, satellite, wireless, xdsl.
client.as.number The autonomous system (AS) number associated with this IP address.
client.as.name The name of the organization associated with client.as.number.

Fastly also exposes codes that describe the location of the datacenter the request came through as follows:

Variable Description
server.region A code representing the general region of the world in which the POP location resides. One of: APAC, Asia, EU-Central, EU-East, EU-West, Middle-East, North-America, SA-East, South-Africa, South-America, US-Central, US-East, US-West.
server.datacenter A code representing one of Fastly's POP locations.

Additional resources:


Back to Top