Creating location-based tagging

  Last updated December 15, 2016

You can set custom HTTP headers in your varnish configuration (VCL) based on the variables we expose. Use the GeoIP 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 GeoIP variables, read about which GeoIP features are accessible to 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 = geoip.country_code;

Back to Top