Edge caching, without the folklore
How GitFlare decides what to cache, how long, and when to revalidate.
Every GET that reaches a GitFlare colo is classified before a byte is written to cache. We look at the method, the Cache-Control request header, whether the URL matched a bypass rule, and the response status. 200, 301, 302, 404 and 410 are eligible; 5xx never is.
Default TTL for an origin that sends no cache headers is 120 seconds on Free and 300 seconds on Pro. You can raise it per path. Tokyo traffic benefits the most: a 300 second TTL on /assets/ typically lifts hit ratio from the high 60s to the low 90s for storefronts we measured in 2026.
Tell the edge what you meant
export default {
async fetch(request, env) {
const res = await env.ORIGIN.fetch(request);
const headers = new Headers(res.headers);
if (request.method === "GET" && res.status === 200) {
headers.set("Cache-Control", "public, max-age=300, stale-while-revalidate=60");
headers.set("CDN-Cache-Control", "max-age=86400");
}
return new Response(res.body, { status: res.status, headers });
},
};
CDN-Cache-Control is honoured only by GitFlare. Browsers still see the shorter Cache-Control, so you can keep HTML fresh in the tab while the colo holds a longer copy for the next visitor in the same city.
Purge without waiting
$ gitflare cache purge --zone shop.example.com --prefix /assets/app.
$ curl -sS -X POST https://api.gitflare.net/v1/zones/shop.example.com/purge \
-H "Authorization: Bearer $GITFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"files":["https://shop.example.com/pricing"]}'
Prefix purge is eventually consistent within a few hundred milliseconds inside a region, and a few seconds worldwide. If you need a hard cut-over, combine it with a versioned filename (app.7e4c91ab.js style) and leave the old object to expire on TTL.
What we do not cache
Requests with Authorization, Cookie on the request, or Set-Cookie on the response skip cache unless you set a cache key that explicitly includes those fields. That is a foot-gun; we keep it off by default.