Skip to content

Instantly share code, notes, and snippets.

@PsyGik
Created July 21, 2022 08:38
Show Gist options
  • Save PsyGik/5e6582904e326ffd896a6f2e3937cb63 to your computer and use it in GitHub Desktop.
Save PsyGik/5e6582904e326ffd896a6f2e3937cb63 to your computer and use it in GitHub Desktop.
Get Geo details from Fastly
synthetic {"{
  "as": {
    "name": ""} json.escape(client.as.name) {""
  },
  "geo": {
    "city": ""} json.escape(client.geo.city) {"",
    "state": ""} json.escape(client.geo.region) {"",
    "state_ascii": ""} json.escape(client.geo.region.ascii) {"",
    "country_code": ""} json.escape(client.geo.country_code) {"",
    "country_name": ""} json.escape(client.geo.country_name) {"",
    "gmt_offset": "} json.escape(client.geo.gmt_offset) {",
    "ip_override": ""} json.escape(client.geo.ip_override) {""
  }
}"};
set obj.status = 200;
set obj.response = "OK";
set obj.http.Content-Type = "application/json";
return (deliver);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment