> For the complete documentation index, see [llms.txt](https://clients.medianova.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/caching/stale-cache.md). Agents can also search and read this documentation through its [MCP server](https://clients.medianova.com/~gitbook/mcp).

# Stale Cache

Configure when Medianova CDN can serve expired cached content during origin failures or while a cached object is being updated.

**Stale Cache** allows CDN edge servers to reuse previously cached content after its TTL expires when specific origin errors, HTTP status codes, or cache update conditions occur. This helps maintain content availability during temporary origin issues.

You can configure Stale Cache through the [Medianova Control Panel](https://cloud.medianova.com) or the [API](https://clients.medianova.com/api-documentation/performance-cdn/caching#put-api-v1-cdn-organization_uuid-resource-resource_uuid-6).

{% hint style="warning" %}
Stale Cache requires a previously cached version of the requested object to be available at the edge. It cannot serve a cached fallback if no previous version exists.

Stale responses may contain outdated content. Select triggers according to your application's content freshness requirements.
{% endhint %}

## Configuration Steps

{% stepper %}
{% step %}

### Open Stale Cache

Open your CDN Resource in the Medianova Control Panel and select **Caching**.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FWnl3SJnQInORLh0yudhs%2Fimage.png?alt=media&#x26;token=a8c36a45-d148-4fe7-8103-cee6c3624ee8" alt="Stale Cache configuration in the Medianova Control Panel"><figcaption><p>Stale Cache configuration.</p></figcaption></figure>
{% endstep %}

{% step %}

### Select Stale Cache Triggers

Under **Stale Cache Triggers**, select the conditions that allow expired cached content to be served.

<table><thead><tr><th width="183">Trigger</th><th>Description</th></tr></thead><tbody><tr><td><code>error</code></td><td>An error occurs while communicating with the origin server.</td></tr><tr><td><code>timeout</code></td><td>The origin does not respond within the configured timeout.</td></tr><tr><td><code>invalid_header</code></td><td>The origin returns an invalid HTTP response header.</td></tr><tr><td><code>http_403</code></td><td>The origin returns <strong>403 Forbidden</strong>.</td></tr><tr><td><code>http_404</code></td><td>The origin returns <strong>404 Not Found</strong>.</td></tr><tr><td><code>http_429</code></td><td>The origin returns <strong>429 Too Many Requests</strong>.</td></tr><tr><td><code>http_500</code></td><td>The origin returns <strong>500 Internal Server Error</strong>.</td></tr><tr><td><code>http_502</code></td><td>The origin returns <strong>502 Bad Gateway</strong>.</td></tr><tr><td><code>http_503</code></td><td>The origin returns <strong>503 Service Unavailable</strong>.</td></tr><tr><td><code>http_504</code></td><td>The origin returns <strong>504 Gateway Timeout</strong>.</td></tr><tr><td><code>updating</code></td><td>A cached object is being updated, allowing an existing stale version to be served during the update.</td></tr></tbody></table>

You can select multiple triggers according to the required fallback behavior.
{% endstep %}

{% step %}

### Save the Configuration

Select **Save** in the pending changes bar.

Review the pending changes and confirm the update to apply the configuration to the CDN Resource.
{% endstep %}
{% endstepper %}

## Stale Cache Behavior

### Serving Expired Content

When a cached object's TTL expires, the CDN normally needs to retrieve or validate the content before serving a fresh response.

If a configured Stale Cache trigger occurs and an expired cached version is available, the CDN can serve that version instead of returning the corresponding origin error.

For example, if `http_503` is enabled and the origin returns **503 Service Unavailable**, the CDN can serve an existing stale version of the requested object.

### Serving Content During Cache Updates

When `updating` is enabled, the CDN can serve stale content while an expired cached object is being updated.

This allows requests to use an existing cached response during the update process rather than waiting for the updated object.

### Returning to Normal Cache Behavior

When the configured stale condition no longer applies, normal caching behavior resumes according to the CDN Resource's cache configuration.

Stale Cache does not change the configured TTL or create cached objects for requests that have never been cached.

## Important Notes

* Stale Cache applies only when a previously cached object is available.
* The CDN serves stale content only under the configured trigger conditions.
* Selecting `http_404` or `http_403` can cause previously cached content to remain accessible even when the origin returns a corresponding error response.
* Stale Cache is different from Error Status Code Cache Expiration, which controls caching of supported HTTP error responses.
* To configure how long cached objects remain fresh, see Edge Cache Expiration.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://clients.medianova.com/products/performance-cdn/static-content-delivery/advanced-configuration/caching/stale-cache.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
