Cache
You can add cache rules from your Magnolia PaaS Cockpit. Caching reduces requests to Magnolia which helps reduce heavy processing loads and improves performance.
Expand the image here to see the different parts of adding a rule in the Cockpit and is applicable to both cache types.
Rule anatomy
-
Add a new rule. Once you click this, a new rule is added to the top of the list.
-
Naming your rule.
-
Choosing the cache type which is Never or a duration (in minutes).
-
Add a voter.
-
Save changes to your rules. This saves changes to Author.
-
Publish rules to production. This saves changes to Public.
-
Move rule up or down. Remember the first to match is accepted.
-
Delete a rule.
Add Browser cache rule
browserCachePolicy is defined in Magnolia.
|
Rules
-
The rules apply from top to down.
-
The first rule matching the request defines which
Cache-Control
header will be applied to the response.
Instructions
To add a Browser cache rule:
-
Go to your Cockpit.
-
Go to Content delivery > Cache (tab).
-
Choose the Browser cache subtab.
-
Click Add a new rule.
The new rule will appear at the top of the rule list where you can edit it.
-
Give the rule a Name.
-
Choose the Type.
Table 1. options Type Description Never cache
You guessed it. It’s never cached.
Cache for
Allows you to set the time something is cached for (in minutes).
-
Choose When it happens using the
AND
orOR
options. -
Click the symbol if you want to add any voters.
-
Choose the condition you want and click Add.
Each condition comes with a preset set of rules you can choose from.
For example, URL starts with condition comes with an option of starts with or does not start with whereby you can add a pattern to fulfill that requirement.
-
-
When you’re happy with your new rule, don’t forget to save you work by going to the top and clicking Save changes.
-
To put your rules into production, you’ll also need to Publish your new rule.
-
Add CDN cache rule
It also helps serve cached content when Magnolia is down or having any issues. |
Rules
-
The rules apply from top to down.
-
The first rule matching the request defines which
Surrogate-Control
header will be applied to the response.-
The
Surrogate-Control
header takes precedence over theCache-Control
one. -
Surrogate-Control
headers are removed before a response is sent to an end user. -
In the absence of the
Surrogate-Control
header, the CDN uses theCache-Control
header.
-
Instructions
To add a CDN cache rule:
-
Go to your Cockpit.
-
Go to Content delivery > Cache (tab).
-
Choose the CDN cache subtab.
-
Click Add a new rule.
The new rule will appear at the top of the rule list where you can edit it.
-
Give the rule a Name.
-
Choose the Type.
Table 2. options Type Description Never cache
You guessed it. It’s never cached.
Cache for
Allows you to set the time something is cached for (in minutes).
-
Choose When it happens using the
AND
orOR
options. -
Click the symbol if you want to add any voters.
-
Choose the condition you want and click Add.
Each condition comes with a preset set of rules you can choose from.
For example, URL starts with condition comes with an option of starts with or does not start with whereby you can add a pattern to fulfill that requirement.
-
-
When you’re happy with your new rule, don’t forget to save you work by going to the top and clicking Save changes.
-
To put your rules into production, you’ll also need to Publish your new rule.
-