Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fastly GeoIP header injection
# Request headers
sub vcl_recv {
set req.http.X-Fastly-Country-Code = geoip.country_code;
set req.http.X-Fastly-Country-Name = geoip.country_name;
set req.http.X-Fastly-City =;
set req.http.X-Fastly-Latitude = geoip.latitude;
set req.http.X-Fastly-Longitude = geoip.longitude;
set req.http.X-Fastly-Region = geoip.region;
#FASTLY recv
# Response headers
sub vcl_deliver {
set resp.http.X-Fastly-Country-Code = geoip.country_code;
set resp.http.X-Fastly-Latitude = geoip.latitude;
set resp.http.X-Fastly-Longitude = geoip.longitude;
#FASTLY deliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment