Edge cache and CDN
The Caching page: Edge Caching, CDN, Server Caching, and Redis, each with one switch and a clear button. Also site preview, geolocation, and Early Hints.
Parts of this feature are still being built. The Not yet section lists them.
Open your site, then Caching. The page has four tabs and a Clear all caches button at the top. Clear all caches empties the page cache, the object cache, PHP's code cache (OPcache), and the edge cache. WordPress admins can also run it from the admin bar. See Clear all caches. Every change runs as a job you can follow in the jobs drawer.
Edge Caching
Edge Caching keeps your pages in Cloudflare locations worldwide, close to your visitors. Disable turns it off, and the tab then hides its cards until you enable it again.
- Mobile cache: a separate page cache for phones. See Mobile cache.
- Clear cache: clears every cache, the same as Clear all caches.
- Clear URL cache: type a path such as
/blog/or a full URL on the site, or pick one from the list. Tick the box to also clear every page under it.
CDN
The CDN serves images, CSS, and JavaScript files from Cloudflare. It runs on the same switch as Edge Caching, so turning one off turns off both. Clear CDN cache clears those files at Cloudflare, which you need when you replace a file and keep its name.
Server Caching
The server keeps a page cache for visitors who are not logged in. Change cache expiration sets how long it keeps a page, from 30 minutes to 30 days. Clear cache clears every cache. Clear any theme or plugin cache first.
The server never caches a page for a logged in visitor, a cart, a POST, or a response that sets a cookie. Strip Set-Cookie in Tools changes the last rule.
Redis
Redis is the object cache add-on. When the site has it, the tab says Enabled and shows whether Avaloi verified that WordPress uses Redis, with the memory used, the keys, and the hit rate. Check again runs the check once more. Without the add-on, Add to plan opens the add-on on Add-ons. See Object cache.
Read the cache header
Every page from the server carries x-avaloi-cache: HIT, MISS, BYPASS, STALE, or EXPIRED. Cache numbers are in Analytics.
Site preview, geolocation, and Early Hints
These edge settings live in Tools. Site preview shows the site on its temporary domain for one hour to seven days and tells search engines not to index it. Geolocation adds the visitor's country, region, and city as request headers.
Not yet
- Avaloi's edge page cache is not switched on for live traffic yet. Until it is, Cloudflare caches static files only and pages come from the server page cache.
- Image optimization and excluding files from the CDN are not offered. Cloudflare's image optimization needs a paid plan, and a per site exclusion would use one of the few shared Cache Rules on the zone.
- Edge page cache times, paths that never cache, and ignored query parameters are set through the API only.
Turning on the edge page cache (Avaloi operators)
Run these from the repository on Windows PowerShell:
- Create the tag index namespace once:
npx [email protected] kv namespace create avaloi-edge-tags, and keep the id it prints. - Set the ids (none of them is a secret):
$env:CLOUDFLARE_ACCOUNT_ID,$env:AVALOI_SAAS_ZONE_ID,$env:AVALOI_EDGE_KV_NAMESPACE_ID, and$env:AVALOI_EDGE_TAGS_KV_NAMESPACE_ID. - Check the bundle without uploading anything:
.\infra\scripts\deploy-edge-worker.ps1 -DryRun. - Deploy with a token that has Workers Scripts Edit, Workers KV Storage Read, and Workers Routes Edit:
.\infra\scripts\deploy-edge-worker.ps1 -TokenSecret <Secret Manager name>. The script refuses to run without a token and never prints it. - On the SaaS zone, add Worker routes with no Worker for the platform's own hostnames, such as
app.avaloi.com/*andapi.avaloi.com/*. - Save the edge settings of each site once, so every hostname has its settings in KV. A hostname without settings is never cached.
- Verify on a test site:
.\infra\scripts\verify-edge-cache.ps1 -Url https://<test site>/ -MobileCache -TokenSecret <Secret Manager name>.
Rollback: delete the */* route on the SaaS zone, or run npx [email protected] delete --name avaloi-edge-cache.
Quick answers
A page shows old content.
Clear the cache for that URL. Check x-avaloi-cache to confirm the next response is a MISS.
Can I clear the caches from WordPress? Yes. Use Clear caches in the admin bar. The edge cache takes up to a minute to spread from there.
API
GET /v1/environments/{id}/cacheandPUT /v1/environments/{id}/cachePOST /v1/environments/{id}/cache/purgewithscopeset toall,urls,tags, orcdnPUT /v1/environments/{id}/tools/mobile-cachePOST /v1/sites/{id}/add-ons/{addon_id}/enableandPOST /v1/sites/{id}/add-ons/{addon_id}/disable, withobject_cacheas the add-on- MCP tool:
clear_cache
Related
Still stuck?
Email [email protected] with your site name and what you tried, or send us a message.