Skip to main content
The Rules section overrides CDN options for specific files — independently of the Resource Settings that apply to all files by default. Each rule matches files by URI pattern or regular expression and applies its own option set to those files only, with a maximum of five rules per CDN resource. As an example: CDN caching settings are enabled for a resource with the CDN-controlled option, which applies to all files. To apply Origin-Controlled to specific files instead, create a rule for those paths and add the Origin-Controlled option — CDN-Controlled then applies everywhere except the paths covered by the rule. The Rules tab shows how many rules have been created for the resource.
Rules section with rule count and Create rule button

Add rules in the customer portal

Rules are added from the Rules tab of any CDN resource. Each rule can be built from scratch or created from a template.

Create a rule manually

1. In the Resource settings, navigate to the Rules tab. Click Create rule and select Create blank rule from the drop-down list.
Create a rule manually
A new page will open. Follow the remaining steps on that page.
Create a rule manually
2. Enter the rule name. 3. Specify the path to the file or folder to which the rule applies. The path must start with ^/ or / and cannot contain the origin domain name. Specify a URI or use regular expressions (regex).
If a URI matches multiple rules, the rule that appears first in the order is applied. For instance, if the resource has two rules — /folder/.* (first) and /folder/image.jpg (second) — the first rule applies to /folder/image.jpg.
4. If the CDN resource has multiple origin groups, select the required group from the Origins Group list. 5. Select the protocol that the CDN resource will use to pull the files specified in step three. If files are accessible over the same protocol as the origin, select Inherit from resource. If not, select the appropriate option: HTTP, HTTPS, or both protocols at once. 6. Click the Add option button to configure options if necessary. A panel opens with the list of available options — click an option name to add it to the rule. When done, close the panel.
Add option panel with available CDN options
There are three variants for how the options in the Rules sections interact with the options in the Resource Settings: 7. Click Create rule.

Create a rule from a template

Templates allow a fixed set of options to be reused across multiple CDN resources. Five system templates are available — Video segments (.ts), Playlists (.m3u8), Let’s Encrypt HTTP-01 challenge, Static content, and Image optimization — and custom templates can be created from any saved rule. Full details are in the templates guide. To create a rule from a template: 1. In the Resource settings, navigate to the Rules tab. Click Create rule. In the dropdown, select Create blank rule to build a rule from scratch, or select a template name under Create from system templates to use a system template, or select a custom template created earlier.
Create rule dropdown showing system templates and custom templates
2. A form opens with pre-filled settings from the template. Review the settings and edit them if needed — the steps in Create a rule apply. 3. Click Create rule.
Create rule from template form with pre-filled settings

Examples of rules

The following examples show how rules can be used to override specific CDN options for a subset of files.

Prohibit caching for static files

To prohibit CDN caching for JPG, CSS, and JS files:
  • Enter ^/.*\.(jpg|css|js)$ to the Rule pattern field.
  • Add the CDN caching option with the “CDN Controlled” and “Do not cache” values.
CDN caching disabled for static files matching the pattern

Set Access-Control-Allow-Origin for .ttf files

To set up the Access-Control-Allow-Origin HTTP header only for files with the .ttf extension:
  • Enter /.*\.ttf$ to the Rule pattern field.
  • Add the CORS header support option.
  • Configure which domains the header applies to — CORS header support explains the available options.
Set Access-Control-Allow-Origin for .ttf files

Suspend, activate, or delete a rule

Rules can be suspended when not needed — for testing purposes or before deletion. Suspended rules do not apply to the specified files but still count toward the rule limit. To suspend a rule: 1. Navigate to the Rules tab and click the rule name to open its settings.
Rules section with rule name link
2. In the Rule availability section, uncheck Enable rule. A confirmation dialog appears — click Yes, suspend.
Rule availability section with Enable rule checkbox unchecked
To activate a suspended rule, click the rule name, check Enable rule, and click Save changes. Suspended rules have a Suspended status and active rules have an Active status in the rules list.
Suspended status and Active status in the rules list
Alternatively, use the three-dot menu next to any rule in the list. For active rules, the menu provides Suspend rule — clicking it opens the same confirmation dialog. For suspended rules, the menu provides Activate rule — clicking it activates the rule immediately, without a confirmation dialog. The three-dot menu also provides Edit to open the rule settings, Save as template to create a template from the current rule configuration, and Delete rule to delete the rule. Only suspended rules can be deleted. To delete a rule: 1. Suspend the rule (see above). 2. Click the three-dot menu next to the suspended rule and select Delete rule. 3. Click Yes, delete to confirm.