Caching Settings

Define content caching policies and caching rules for your website on the Performance Settings page.

Learn more: Content Caching

Note: After making changes to cache settings, you may want to manually clear the cache. For details, see Purge the cache below.


In this topic:

Set caching mode

Caching mode settings let you configure overall caching policy for a website.

The following caching modes are supported:
Caching Mode Description
Disable Caching No caching is performed and all requested content is retrieved from your origin web server.
Static Only

Only content that was marked by the site's developer / web server as static using standard HTTP headers is cached.

Static + Dynamic

In addition to content that was marked by the site's developer / web server as static using standard HTTP headers, Incapsula also profiles other resources to identify and cache static content that was not marked as such. The time period (in minutes, hours, days or weeks) that you set for this option determines how often the cache is refreshed.

Note: This option does not cache personalized or dynamic content.

Aggressive All site content is cached. The time period (in minutes, hours, days or weeks) that you set for this option determines how often the cache is refreshed (TTL).

Caching HTTPS traffic

When Incapsula caching mode is set to Static + Dynamic, the default caching behavior for HTTPS is as follows:

  • Only the following resources may be cached heuristically: images, css files, JavaScript files, and resources defined with the Cache-Control: public header.
  • Resources that include explicit caching directives against caching, as defined in the resources themselves using the Cache-Control or Expires HTTP headers, are not cached.
  • HTML files are not cached.
  • Asynchronous validation is not used.

Caution: If you override this default behavior by setting an explicit Advanced Caching Rule for the site to cache HTML files, you can introduce the risk of returning HTML resources that contain personal information, such as PII, ePHI, and PAN data.

Define caching rules

Advanced caching rules let you define specific exceptions to the caching rules that are set by the overall Caching Mode rules (described above). You can define specific URLs or a group of URLs which should always be cached or should never be cached.

A caching rule contains a URL string-matching directive (the leftmost field shown above) and a string to match (the second leftmost field shown above).

The following table summarizes the types of advanced caching rules:

String-Matching Rule String Example Matches Doesn't Match
URL is /images /images /images/background /home
URL is not /images /images/background /home /images
URL starts with /images /images/background /home /home
URL ends with jpeg /image.jpeg /home/logo.jpeg /image.png /home
URL contains /background/ /images/background/image.jpeg /css/background/main.css /images/background
URL does not contain /background/ /images/background /images/background/image.jpeg /css/background/main.css

Precedence among caching rules

Because there may possibly be conflicts between the Advanced Caching Rules and the logic dictated by the Caching Mode, the following order of precedence is applied to the various types of rules:

  1. Never Cache Advanced Rules
  2. Always Cache Advanced Rules
  3. Caching Mode
  4. Cache directives sent by the web server (in HTTP headers)

Note: If there is a conflict between the caching durations defined in the Caching Mode and in the Advanced Caching Rules, the longer period of the two is applied. The same goes for a conflict between the caching rule of a certain resource and one of its sub-resources.

Additional settings

The following options let you control HTTP features that may interfere with Incapsula's caching behavior, thereby reducing performance. These are triggered by HTTP request and response headers that instruct the web server or client not to cache certain content, or by the browser’s behavior.

These caching options are often enabled on web servers or browsers due to misconfiguration, so the default behavior is to ignore them. You can change this behavior using the settings below.

Option Description
Comply with no-cache and max-age directives in client requests

When the Comply with no-cache and max-age option is checked, these cache directives are considered; otherwise they are dynamically profiled by Incapsula and re-configured to optimize performance (which is the default behavior).

no-cache is a directive in the HTTP Cache-Control request header that instructs web proxies not to return cached content without first checking with the server to see if the content has changed.

max-age is a directive in the HTTP Cache-Control request header that instructs web proxies not to return content that is over a certain expiration age.

Comply with Vary

Vary is an HTTP response header that indicates how to match future request headers to decide if a cached response can be used.

By default, the Vary header is ignored. When the Comply with Vary option is selected, the Vary header is taken into account.

Note: Accept-Encoding is ignored. All other Vary headers are accepted.

Use shortest caching duration in case of conflicts Usually when there is a duration conflict between caching rules or modes, the longest duration is used. When this option is checked, Incapsula uses the shortest duration in case of conflict.
Prefer 'last modified' over eTag When this option is checked, Incapsula prefers using Last Modified values (if available) over eTag values (recommended on multi-server setups).
Disable client-side caching When this option is checked content will only be cached on the Incapsula proxies and not on client browsers.
Also cache 3xx responses When this option is checked Incapsula will cache 301, 302, 303, 307, and 308 response headers containing the target URI. 3xx caching can only be triggered through HTTP response headers or caching rules.

Cache response headers

Use this option to specify which response headers should be cached along with the resource.

Purge the cache

After a major change to your website, such as a version update, you may want to clear all resources in the cache immediately, without waiting for the caching period to expire.

You can purge the entire cache, or purge a subset of the site's cached resources.

To purge the entire cache:

In the Caching Mode section, click Purge Cache. All cached resources for the site will be purged.

To purge specific resources from the cache:
  1. In the Caching Mode section, click Purge Specific Resource. The following displays:

  2. Select one of the URL rule options (URL is, URL contains, URL starts with or URL ends with).
  3. In the field on the right, do one of the following:
    • For the URL is rule, enter a complete URL, such as /intro/settings/logo.png
    • For one of the other rules, enter a specific URL string that will be matched as a prefix, midfix or suffix of the URL, depending on the rule.
  4. Click the Purge button.

Note: You can automate the purge cache action using the API. For details, see Site Management API.

Read More