> For the complete documentation index, see [llms.txt](https://docs.link11.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.link11.com/product-guides/secure-cdn/interface/instances/cdn-location-caching-settings.md).

# CDN Location Caching Settings

## Caching Settings

<figure><img src="/files/VU4OLsAOwOfm4F9yDlti" alt=""><figcaption></figcaption></figure>

This page provides the ability to control CDN caching behavior for specific sections of a site. Other configuration options are available in the [General Settings](/product-guides/secure-cdn/interface/instances/cdn-location-general-settings.md).

## Overview

Under normal circumstances, Link11 Secure CDN respects all settings (such as *Cache-Control* headers) from customer origin servers.

However, in some situations, it can be helpful to define a different set of behaviors. For example, the origin server's cache settings might not be ideal, or are undefined, but the settings would be difficult or inconvenient to change. The *Caching Settings* tab provides the ability to easily control the cache-related behavior of the overall system at a granular level.

Caching settings are applied hierarchically, from general to specific. A common setup would be to define broadly-applicable settings for the root level location; these will be applied by default to the entire site. Then, the settings for more specific location definitions will override them.

## Cache Mode

Cache Mode controls how Secure CDN decides whether a response is eligible to be cached.

There are three modes:

* **Header-Based (default)** — respects the `Cache-Control` and other cache headers sent by the origin server.
* **Static** — caches a predefined set of MIME types and file extensions automatically; cache-control headers are ignored.
* **Hybrid** — respects cache headers where they are used; otherwise falls back to static cache mode settings.

Cache Mode is configured per location.

### Header-Based (default)

In Header-Based mode, Secure CDN respects the `Cache-Control` and other cache headers sent by your origin server to decide whether, and for how long, a response is cached. This is the default and works together with all of the other per-location controls described below.

Choose this mode when your origin already returns correct and reliable cache headers and you want the CDN to follow them.

### Static

In Static mode, the caching decision is driven entirely by the response's MIME type (and file extension). This means cache-control headers from the origin are ignored. Any response whose MIME type matches your selected set is cached using the location's Default TTL; all other content passes through uncached.

This lets you cache static assets — images, stylesheets, scripts, fonts, and similar — even when your origin sends no cache headers, or sends headers you don't want to honor. You choose exactly which MIME types are cached (see MIME Types for Static Mode below).

The cache lifetime is governed by the Default TTL.

Choose this mode when your origin does not send usable cache headers but you still want static content accelerated at the edge.

### Hybrid

Hybrid mode combines both approaches: Secure CDN respects the origin's cache headers where they are present, and where the origin sends no cache header, it falls back to the static cache mode settings — caching the response if its MIME type is in your selected set, using the Default TTL.

This avoids the situation where missing headers leave otherwise-cacheable static content uncached, while still honoring every cache header the origin does send.

Choose this mode when your origin sends cache headers inconsistently — present on some responses, missing on others.

### MIME Types for Static Mode

The MIME type selection applies to both Static and Hybrid modes. Open the picker with Edit on the Caching Settings tab. The picker groups the supported MIME types into Images, Web Assets, Fonts, Documents & Data, Audio & Video, and Archives.

By default, all types under **Images, Web Assets, Fonts, and Audio & Video** are selected, and **Documents & Data** and **Archives** are left unselected. This covers the binary file types that are not user in most cases not user-specific. We recommend reviewing the full list and adjusting the selection to your use case — for example, enabling document or archive types you serve as static downloads, or deselecting anything generated per user.

Because Static mode ignores cache-control headers, only cache a MIME type whose content is the same for every user. Take particular care with types that are often dynamic or personalized such as `text/html`, `application/json`, and XML feeds.

> ⚠️ At least one MIME type must be selected when static or hybrid mode is active, otherwise the configuration cannot be saved.

### Responses that are never cached

Regardless of the Cache Mode, some responses are never cached to protect against caching per-user or sensitive content:

* In all modes, responses carrying a `Set-Cookie` header (avoid sending `Set-Cookie` on static assets you expect to be cached).
* In Header-Based and Hybrid modes, responses whose cache headers mark them as non-cacheable (for example `no-store` or `private`). (This is not the case in static mode, be careful not to enable a MIME type used for per-user content.)

If content you expect to be cached is not being cached, check for these response headers at your origin first.

## Default Time to Live

This setting is used to instruct Secure CDN to either:

* **Always cache content, unless explicitly instructed by the server**. When *Default Time to Live* is set to a non-zero value, it becomes the default value for cache expiration. If the server included a time-to-live header in its response, this defines the expiration time; otherwise, Secure CDN will use *Default Time to Live* instead.
* Or, **never cache content, unless explicitly instructed by the server**. When *Default Time to Live* is set to zero, this will prevent Secure CDN from caching content, except for those assets where the server included a header to set the cache expiration to a non-zero value.

{% hint style="info" %}
The discussion above assumes that [**Ignore Headers**](#ignore-headers) is set to `OFF`. To completely override the server's instructions, set it to `ON` instead. See its description below for the implications of this.
{% endhint %}

Selecting the **Edit** button will display the following dialog:

<figure><img src="/files/aBocB5yA1AWK3Rhyj5j4" alt=""><figcaption></figcaption></figure>

As seen here, there are separate values for successful responses (status codes 200/301/302) and unsuccessful responses (all other status codes).

## Disable Caching

Turning this setting `ON` will prevent Secure CDN from caching any content for this location. All other cache settings and instructions from the origin server will be ignored.&#x20;

{% hint style="info" %}
If [Cache Status Header](#cache-status-header) is also `ON`, the X-Proxy-Cache header value will be `BYPASS`.
{% endhint %}

As mentioned above, *Caching Settings* are applied from general to specific. Thus, this setting can be used to disable caching everywhere, except for a certain section of a site:

* For the root location, *Disable Caching* would be `ON`.
* For the specific location, it would be `OFF`.

In this configuration, even if the server specifies caching parameters, caching would not occur anywhere, except for that location.

The inverse of this configuration can also be useful: caching can occur everywhere *except* for the specific location.

## Stale Content

"Stale" content is content that has been cached for a time period that's equal to or greater than the *Default Time to Live*.

Secure CDN will attempt to refresh this content, but sometimes this might not be possible (for example, if the origin server is down). The *Stale Content* setting allows Secure CDN to continue to serve it until it can be updated.

Turning this feature `ON` and selecting the **Edit** button will display a list of checkboxes for different situations (e.g., server error, server timeout, 5XX errors, etc.) :

<figure><img src="/files/Qyksl6vouSd0zeTanLJ4" alt=""><figcaption></figcaption></figure>

For the conditions checked in this list, Secure CDN will continue to serve the content, even if it becomes stale.

## Ignore Headers

When this setting is `ON`, Secure CDN will ignore the specified headers from the origin server, and instead, will behave according to the various *Caching Settings* in this tab, especially [*Default Time to Live*](#default-time-to-live)**.**

{% hint style="info" %}
This feature is a convenient way of overriding server settings for specific locations, or even entire sites. As such, it should be used with caution, to ensure that sensitive content is not cached unintentionally.
{% endhint %}

When Ignore Headers is `ON`, and the time-to-live headers listed there (`X-Accel-Expires`, `Cache-Control`, and `Expires`) are all selected, then Secure CDN will either:

* **Always cache content**. When *Default Time to Live* is set to a non-zero value, it becomes the equivalent of the `Cache-Control` header's *max-age* parameter, which will apply regardless of the headers the server includes in its response. (Thus, customers can ensure that content is always cached, whether or not the server specified this.)
* Or, **never cache content**. When *Default Time to Live* is set to zero, Secure CDN will not cache any content, regardless of whatever headers the server might include.

Selecting the **Edit** button will display a list of specific headers:

<figure><img src="/files/uCgXjFwa0d1Dl7Ttj1Gq" alt=""><figcaption></figcaption></figure>

For those that are checked, the server's instructions will be ignored.

## Revalidate Content

This setting can be helpful in reducing the load on the server.

Normally, when a request is received for stale content (content whose cache time has exceeded *Default Time to Live*), Secure CDN will re-fetch that content and serve it to the client.

Turning this setting `ON` will change this behavior. After receiving the request for stale content, Secure CDN will query the origin to see if the content has changed since the most recent fetch:

* If it has, the content will be re-fetched and then served.
* If it has not, the current cache will be served. The *Default Time to Live* timer will be reset, and the cache will not be re-validated until that time has passed once again.

## Cache Status Header

Turning this setting to `ON` adds `X-Proxy-Cache` headers to all responses. Its possible values are:

* `HIT`: the content was served from cache
* `MISS`: the content was uncached, and was fetched from the origin server
* `BYPASS`: the cache was ignored (because [Disable Caching](#disable-caching) was `ON`), and the content was fetched from the origin
* `EXPIRED` : the cache had expired, so fresh content was fetched and served
* `STALE`: the cache had expired, but fresh content could not be fetched, so stale content was served
* `UPDATING`: the cache had expired, but fresh content is still being fetched, so stale content was served
* `REVALIDATED`: cached content was served after the origin confirmed that it is still current

## Cache Lock

This feature can mitigate load on the origin server in high-traffic situations, by reducing concurrent requests from the CDN.

When turned `ON`, multiple requests for the same uncached or expired content will be processed as follows:

* The initial request will trigger a fetch from the origin server.
* Subsequent requests for the same content will wait in a queue until the fetch has been completed. The fetched content will be cached and served to the clients that were waiting for it.\
  Thus, the origin only has to provide the content once.

Selecting the **Edit** button will display these parameters for configuration:

<figure><img src="/files/rvTJwbS6TMT1zjpUhYZS" alt=""><figcaption></figcaption></figure>

**Lock Age** is the maximum amount of time that the initial request can maintain the lock. Once this time has been exceeded, the next request in the queue will be sent to the origin. This setting is designed to prevent a problematic request from blocking all the rest.

**Lock Timeout** is the maximum amount of time that a subsequent request will wait for the lock to be released. Once this time has been exceeded, the request will proceed to the origin, bypassing the cache lock.

***
