Creating location-based tagging

  Last updated April 26, 2018

You can set custom HTTP headers in your varnish configuration (VCL) based on the variables we expose. Use the geolocation features we have built into Varnish to create location-based tagging. We provide a list of geographic information based on a client's IP address. For a complete list of available geolocation variables, read about which geolocation features are accessible via VCL.

In the example below, an HTTP header Fastly-GeoIP-CountryCode is created with the two letter country code of the client's IP address.

sub vcl_recv {
  set req.http.fastly-GeoIP-CountryCode = client.geo.country_code;

Back to Top