Post

Fastly Cheatsheet

Purge from curl using local enviroment variables

1
curl -i -X POST "https://api.fastly.com/service/${FASTLY_API_SERVICE}/purge_all" -H "Fastly-Key: ${FASTLY_API_TOKEN}" -H "Accept: application/json"

Fastly CLI — Install

1
brew install fastly/tap/fastly

Fastly CLI — Authenticate

1
fastly profile create

Fastly CLI — Deploy a Service

1
fastly compute deploy

Fastly CLI — Tail Live Logs

1
fastly log-tail --service-id={service_id}

Fastly CLI — List Services

1
fastly service list

Check Cache Status of a URL

Look for X-Cache and X-Cache-Hits in the response headers:

1
curl -sI https://example.com/path | grep -i "x-cache\|age\|surrogate"

Edge Dictionary — Read a Value in VCL

1
2
declare local var.value STRING;
set var.value = table.lookup(my_dictionary, req.http.host);

Useful Fastly Response Headers

HeaderMeaning
X-Cache: HITServed from Fastly cache
X-Cache: MISSFetched from origin
X-Cache-Hits: 3Hit count for this object
Age: 120Seconds object has been cached
Fastly-Debug-DigestInternal object hash
This post is licensed under CC BY 4.0 by the author.