Use cases
- Cache static assets (images, CSS, JS) for longer periods
- Set shorter cache times for dynamic content
- Cache video files for extended periods to reduce origin load
- Override default cache behavior for specific file types
Configuration
1
Open Edge Rules
Navigate to your pull zone and select Edge Rules from the side menu.
2
Add a new rule
Click Add Edge Rule to create a new rule.
3
Select the Override Cache Time action
Choose Override Cache Time as the action.Enter the desired cache time in seconds:
4
Add a File Extension condition
Click Add Condition and select File Extension as the condition type.Enter the extension you want to match (without the dot). For example:
mp4for video filesjpgfor JPEG imagescssfor stylesheets
5
Save the rule
Click Save Edge Rule to activate.
Examples
Cache video files for 30 days
Cache images for 1 week
Create separate rules for each file extension, or use multiple conditions with
Match Any to apply the same cache time to multiple extensions.
Bypass cache for HTML files
To prevent caching of HTML files entirely:Multiple extensions
To apply the same cache time to multiple file types, you have two options:Option 1: Multiple conditions (Match Any)
Add multiple File Extension conditions to a single rule and set the match type to Match Any:- Condition 1: File Extension =
jpg - Condition 2: File Extension =
png - Condition 3: File Extension =
gif
Option 2: Separate rules
Create individual rules for each extension. This gives you more flexibility if you later need different cache times per extension.Cache time vs Browser cache time
Edge Rules offer two cache-related actions:
You can use both together to have different cache durations at the edge vs in the browser.
Related
- Smart Cache - Default cache settings for your pull zone
- Trigger Path Setup - Alternative way to match files using wildcards
- Rule Ordering - Understand how multiple cache rules interact