You can see cache information directly in your Cockpit in the Content delivery section. You can configure what items are cached.

To configure what to cache, you need to update the configuration in your Magnolia instance and not directly via the CDN.

Typically, you would find this at:


configure cache resources

Default items

By default, CSS, JavaScript, and images are cached. Pages are not cached by default. However, you can configure your policy to cache Pages. See Server cache policy for help with that.


Cache configuration is defined in /modules/cache/config/contentCaching/. Within each configuration you can define:

  • What to cache.

  • When to flush the cache.

  • What header data to pass to browsers.

  • Specific implementations of tasks.


To select one of the cache configurations, set the defaultContentCachingConfigurationName parameter in the Cache filter. The chosen configuration is read into a JavaBean using the Node2Bean mechanism, making it dynamically available to your own module code.


Policy configuration

Caching behavior for each configuration is defined with policies.

Server cache policy

This policy defines whether the requested content should be cached or not. The decision to cache relies on voters, which are used whenever configuration values are not assigned at startup but depend on rules.

Voters evaluate a rule such as `should content residing at this URL be cached'' and return a positive or negative response. By default, all content on public instances is cached except the AdminCentral UI at `/.magnolia. Server cache policy is configured in /modules/cache/config/contentCaching defaultPageCache/cachePolicy.

The default implementation (Default) checks if the content exists in the cache store and requests caching if the content is not found. The alternative class (Never) instructs the cache not to store the generated content. Server-side re-caching of no-cache requests (shift reload) is configurable and set to false by default.


Cache key generator

You can define a custom cache key generator or configure the default one to meet your needs.


Attribute Default Description



Use URI as part of cache key.



Use request query as part of cache key.



Use request method (GET/POST/HEAD) as part of cache key.



Use server name as part of cache key.



Save information whether this request was made using a secure channel, such as HTTPS as part of cache key.



Use user name as part of cache key.



Use locale info.magnolia.cms.core.AggregationState#getLocale as part of cache key.



Use channel info.magnolia.cms.core.AggregationState#getChannel as part of cache key.

Client (browser) cache policy

Allows for different policies for different content types. Voters are used to define the caching rules. These policies define how long the browser may cache each content type. The time is passed to the browser in the response header. The FixedDuration option instructs the browser to cache the content for the specified length of time in minutes. Never instructs the browser to do nothing.

Client cache policy is configured in /modules/cache/config/contentCaching/defaultPageCache/browserCachePolicy.

This is where we define cache headers. Fastly processes these defined headers. You can also set certain headers so that it affects only Fastly and not the browser cache.

See Fastly’s docs for more on controlling cache.


Flush policy

The Flush policy defines when to flush the cache. There are two policies installed per default.

Changes in workspaces

This configuration observes changes (content publication, import, edit) in a workspace and flushes the cache if new or modified content is detected. Cache can be flushed completely, partially or not at all. Each module can register its own flush policy (or multiple policies) and receive notification about new or modified content in each workspace. Flush policies are informed about changes in observed workspaces. The list of observed workspaces can be defined per policy under the workspaces subnode of each policy or all workspaces will trigger cache flush unless defined under excludedWorkspaces subnode (default configuration). If your custom workspace doesn’t affect the content of pages, you should register it under excludedWorkspaces, otherwise, a change in your workspace will unnecessarily flush the cache.

Changes in light modules

Magnolia 5.6.1+: A change in the light modules folder may also flush the server cache. See /modules/cache/config/contentCaching/defaultPageCache/flushPolicy/policies/lightModule/pathToCacheMappings/defaultPageCache with the pattern property, which specifies the pattern for the operation. The default value is ./(templates|webresources|i18n)/..



These are actions taken once a caching decision has been made. There are three possible actions:

  1. useCache: Retrieves the cached item from the cache and streams it to the client.

  2. store: Stores the response in the cache for future use.

  3. bypass: Skips caching. This is useful for content that cannot or should not be cached.

Executors can be configured at /modules/cache/config/contentCaching/defaultPageCache/executors. Each of the executors is also responsible for configuring expiration headers.



Compression is a simple and effective way to save bandwidth and speed up your site. It is a common practice used by Google and Yahoo! for example. (How to Optimize Your Site with GZIP Compression is a great general introduction to the topic).

Compression is performed in the gzip filter, configured in /server/filters/gzip}. When a client requests a resource such as index.html, Magnolia delivers it zipped. A typical HTML page is compressed to 20% of its original size. So if your page is 100 kB uncompressed, it is 20 kB compressed. To improve performance further, zipped content is streamed from the repository to the client rather than read into memory first.


You can configure which content types to compress. By default, the gzip filter bypasses compression for HTML, JavaScript and CSS because they are explicitly selected for compression in the Cache module configuration. These types can be compressed efficiently because they are text. The decision to compress a particular content type is made with voters. Voters are used whenever configuration values are not assigned at startup but depend on rules instead. In the Cache module configuration there are three voting rules based on content type:

  • text/html: HTML.

  • application/x-javascript: JavaScript.

  • text/css: Cascading Style Sheets.


To add more content types, such as XML, create a numbered property under allowed. Use the Internet media type (MIME type) as value. Here are some common media types:

  • application/xhtml-xml: XHTML.

  • text/csv: Comma-separated value.

  • text/plain: Textual data.

  • text/xml: Extensible Markup Language.

  • application/pdf: Portable Document Format.

As a rule, compressing the HTML, JavaScript and CSS is sufficient; it is not necessary to compress binary content such as images. During the process, the browser sends a header telling the server that it accepts compressed content: Accept-Encoding: gzip. Note that Magnolia does not cache big binaries.

Testing compression

To test your compression configuration, use a tool such as Web-Sniffer that allows you to change the Accept, Encoding and User-Agent sent headers easily. Here’s what the headers look like when the Magnolia demo site home page is submitted^ to the sniffer.

Request header
GET /demo-project.html HTTP/1.1 Host:
Connection: close User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
de; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7 Cache-Control: no
[source]pt-Language: de,en;q=0.7,en-us;q=0.3 Referer:
Response header
Status: HTTP/1.1 200 OK Date: Fri, 23 Jul 2010 07:45:10 GMT Server:
Apache/2.2.9 X-Magnolia-Registration: Registered Cache-Control:
max-age=900 Last-Modified: Thu, 01 Jul 2010 14:03:12 GMT
Content-Encoding: gzip Vary: Accept-Encoding Content-Length: 3852
[source]ection: close Content-Type: text/html;charset=UTF-8