Configuration

Contents

Global configuration

Configure Booster by adding a configuration file to your XP instance.

XP_HOME/config/com.enonic.app.booster.cfg

Example configuration with default values
cacheTtl = 3600
cacheSize = 10000
appsForceInvalidateOnInstall =
excludeQueryParams =
disableCacheStatusHeader = false
cacheMimeTypes = text/html, text/xhtml
overrideHeaders =
cacheTtl

Default time-to-live (TTL) for the cache is seconds. The default value is 3600 seconds (1 hour).

cacheSize

Total number of items in the cache. The default value is 10000.

appsForceInvalidateOnInstall

Comma-separated list of applications that should invalidate the cache on their installation. By default, no applications are listed.

excludeQueryParams

Comma-separated list of query parameters that should be excluded from the cache key. Allows to add extra query parameters to exclude from the cache key without need to change default. By default, no extra query parameters are listed.

excludeQueryParamsPreset

This comma-separated list contains "preset" of query parameters that will not be affected by changing excludeQueryParams. More details about this below:

disableCacheStatusHeader

If set to true Cache-Status header is not sent in the response. The default value is false.

cacheMimeTypes

Comma-separated list of MIME types that should be cached. The default value is text/html, text/xhtml.

overrideHeaders

Comma-separated list of instructions that override headers. By default, no instructions are listed. Use with causion.

Query Parameters

Booster considers query parameters when generating the cache key. However, some query parameters are not relevant, and should be excluded for a better performing cache. Examples of such are marketing and ads related parameters, where the rendered result will look the same regardlessly.

excludeQueryParamsPreset contains a list query parameters that should be excluded from the cache key. These complete list is:

fbclid, twclid, dclid, gclid, gclsrc, wbraid, gbraid, msclkid, yclid, _ga, _gl, utm_source, utm_medium, utm_campaign, utm_term, utm_source_platform, utm_creative_format, utm_marketing_tactic, _hsenc, __hssc, __hstc, __hsfp, hsCtaTracking

If you want to keep the default list and add extra query parameters to exclude from the cache key, you can use the excludeQueryParams configuration property. To override the presets, simply add your own version of excludeQueryParamsPreset in the configuration file.

If page rendering varies on any of the excluded parameters, make sure that Booster application does not cache the response, for instance by having Cache-Control: private header in the controller’s response.

MIME Types

Booster caches text/html and text/xhtml MIME types by default. The cacheMimeTypes configuration property is a comma-separated list of MIME types that should be cached.

Allow caching of text/plain (such as robots.txt), text/xml (such as sitemap.xml) and application/manifest+json (manifest.json) MIME types:

cacheMimeTypes=text/html, text/xhtml, text/plain, text/xml, application/manifest+json
Booster does not cache responses with Vary header, including but not limited to Vary: Accept.

Control downstream cache

Different CDN and proxy servers can cache the response. Booster can help to control the downstream cache by using overrideHeaders configuration property allows to override response headers. The property is a comma-separated list of instructions that override headers. Each instruction is a key-value pair separated by a colon. The key is the header name and the value is the header value. The header value can contain placeholders that are replaced with the actual value from the original response.

Disable caching in the downstream cache (CDN and browser):

overrideHeaders="Cache-Control: private, no-store"

Disable cache in Fastly CDN but leave browser caching instruction as is:

overrideHeaders="Surrogate-Control: private"

Disable cache in Cloudflare CDN but leave browser caching instruction as is:

overrideHeaders="Cloudflare-CDN-Cache-Control: private"

Allow Fastly CDN to cache the response for 24 hours, but browser should cache the response for 1 minute:

overrideHeaders="Surrogate-Control: max-age=86400","Cache-Control: max-age=60"

Site configuration

When adding Booster to a site, it may be tuned specifically

Adding Booster to your site

Cache patterns

By default, Booster caches all regular paths within a site. However, there are cases when some paths should not be cached, or only some paths should be cached.

Patterns lets you tune caching only for specific paths.

If no patterns are provided, all paths are cached. By adding a pattern, no path are cached by default, and you must ensure at least one pattern matches requests to be cached.

A pattern is a regular expression that is used to match the request path. A pattern element may also contain an invert attribute to indicate that the result of evaluating the regular expression should be negated.

The syntax of the pattern is the same as XP Framework pattern mappings.

Default TTL

Default TTL setting allows to specify cache TTL for controller responses without max-age or s-max-age headers. By default, the value is not set and the cache TTL is determined by the cacheTtl configuration property.


Contents

Contents