- 18 Feb 2024
- 1 Minute to read
- Print
- PDF
Understanding the Rules Feature
- Updated on 18 Feb 2024
- 1 Minute to read
- Print
- PDF
Rules are used to configure the CDN behavior. They can be used to influence origin selection, cache configuration, and access control.
Rules may be configured at the host or path level. Create a path rule to apply custom rules to a specific portion of your content. For example, you might want to apply special rules to popular content or manifests. When the CDN receives a request for content located in a particular path, any rules configured for the path are applied, according to rule order.
Path Inheritance
A path either inherits or overrides the configurations of the parent host.
When a path match occurs, any distinct rules configured for the host are inherited by the path.
For example, if a Cache Time to Live rule is defined at the host level, and a Compression rule is defined at the path level, then both rules are applied to the path.
If the same rule is defined at both the host and path level, the rule configuration at the path level overrides the configuration inherited from the host.
For example, if a Cache Time to Live rule is defined at both the host and the path level, then the Cache Time to Live rule configured for the path overrides the host Cache Time to Live rule.
The inheritance logic for Processing Stage Rules (On Client Request, On Client Response, On Origin Request) considers them as a single entity. Therefore, if any Processing Stage rule is configured at the path level, it overrides all processing stage rules configured at the host level.
For example, if the host configuration includes an On Client Request and an On Client Response rule, and the path configuration includes an On Origin Request rule, then only the On Origin Request rule is applied to the path.
While you can add or modify a rule at any time, if your site is already published, you'll have to save the site configuration and publish it to activate the change in production.