Skip to content

Instantly share code, notes, and snippets.

@mshmsh5000
Last active August 7, 2018 09:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshmsh5000/3efff21a83dabfa6a54a35850c6bd222 to your computer and use it in GitHub Desktop.
Save mshmsh5000/3efff21a83dabfa6a54a35850c6bd222 to your computer and use it in GitHub Desktop.
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 = geoip.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