Before you begin
- A zone with at least one proxied name. See DNS.
- The
techoradminrole.
Turn on the cache
- Open the zone and go to Caching.
- Turn on Cache at the edge. Use Scope to apply it to the whole domain or a single name.
- Select Save changes and give a reason.
openwaf-cloud ctl zones set example.com cache.enabled:=true --reason "cache static files"
# Only one name:
openwaf-cloud ctl zones set example.com --host static.example.com cache.enabled:=true --reason "cache static files"curl -s -X PATCH https://dash.openwaf.dev/v1/orgs/$ORG/zones/$ZONE/edge \
-H "Authorization: Bearer $OPENWAF_TOKEN" \
-H "Content-Type: application/json" \
-H "X-Change-Reason: cache static files" \
-d '{"cache": {"enabled": true}}'update_settings with {"zone": "example.com", "settings": {"cache": {"enabled": true}}, "reason": "cache static files"}: first confirm=false to see the diff, then confirm=true with expected_version.
The change reaches the edge nodes with their next configuration, usually within seconds.
Check that it works
Request a static file twice:
curl -sI https://www.example.com/app.css | grep -i -E 'x-cache-status|cache-status|age'The first answer is a MISS (fetched from the origin and stored); the next ones from the same edge node are HIT with an Age:
x-cache-status: HIT
cache-status: OpenWAF; hit
age: 42An HTML page answers DYNAMIC: HTML isn't cached by default. See Cache status headers for every value.