
This test demonstrates how the Cloudflare Cache Everything rule works.
Cloudflare normally does not cache HTML. With this rule, all content is cached at the Cloudflare Edge. This test lets you verify whether HTML, CSS, JS, and JPG files are cached and what their TTLs are.
Use Cases: High-traffic and mostly static pages (campaign landing pages, static images).
Benefits: Reduces origin load and improves page load speed.
Risks: If dynamic content is cached by mistake, security issues may arise.
# ---- Cache Everything ----
location /cdn/static/ {
alias /var/www/cloudflare/application-service/cdn/static/;
index static_test.html;
try_files $uri $uri/ =404;
}
The Cloudflare Cache Everything rule is applied for this test.
Edge Cache TTL is set to 60 seconds.
First request fetches from origin because content is not present in Cloudflare Edge Cache →
cf-cache-status: MISS. To observe MISS perform a Purge first.
If same command runs again before TTL expires → cf-cache-status: HIT.
After TTL expiration Cloudflare revalidates with origin:
cf-cache-status: REVALIDATED.cf-cache-status: EXPIRED.curl -svo /dev/null 'https://cdn.cloudflares.online/cdn/static/static_test.html' 2>&1 | grep -i 'cf-cache-status:'
curl.exe -s -D - "https://cdn.cloudflares.online/cdn/static/static_test.html" -o NUL | Select-String -Pattern '^CF-Cache-Status:' -CaseSensitive:$false
curl -svo /dev/null 'https://cdn.cloudflares.online/cdn/static/static_test.css' 2>&1 | grep -i 'cf-cache-status:'
curl.exe -s -D - "https://cdn.cloudflares.online/cdn/static/static_test.css" -o NUL | Select-String -Pattern '^CF-Cache-Status:' -CaseSensitive:$false
curl -svo /dev/null 'https://cdn.cloudflares.online/cdn/static/static_test.js' 2>&1 | grep -i 'cf-cache-status:'
curl.exe -s -D - "https://cdn.cloudflares.online/cdn/static/static_test.js" -o NUL | Select-String -Pattern '^CF-Cache-Status:' -CaseSensitive:$false
curl -svo /dev/null 'https://cdn.cloudflares.online/cdn/static/static_api_response.json' 2>&1 | grep -i 'cf-cache-status:'
curl.exe -s -D - "https://cdn.cloudflares.online/cdn/static/static_api_response.json" -o NUL | Select-String -Pattern '^CF-Cache-Status:' -CaseSensitive:$false
curl -svo /dev/null 'https://cdn.cloudflares.online/cdn/static/image.png' 2>&1 | grep -i 'cf-cache-status:'
curl.exe -s -D - "https://cdn.cloudflares.online/cdn/static/image.png" -o NUL | Select-String -Pattern '^CF-Cache-Status:' -CaseSensitive:$false
MISS → Content fetched from origin.
HIT → Content served from Cloudflare cache.
EXPIRED → TTL expired; validated with origin and if changed served from origin.
REVALIDATED → TTL expired; validated with origin and if unchanged served from cache.
Cloudflare Cache Rules manage how and for how long content is cached. Short descriptions:
Loading...
Watch this short demo to observe CDN in action.