# Cookie Base Cache

The **Cookie Base Cache** feature allows you to **include selected cookies in the CDN cache key** for **Dynamic Content Acceleration** resources.\
This ensures that different user sessions or states receive the correct cached response without disabling caching entirely.

{% hint style="info" %}
This feature is available **only for Dynamic CDN Resources**.
{% endhint %}

## How Cookie Base Cache Works

When **Cookie Base Cache** is enabled:

* The CDN inspects incoming requests for the configured **Cookie Key** values.
* The specified cookies are included as part of the **cache key**.
* Requests with different cookie values are cached **separately**.
* Requests without the configured cookies follow the default cache behavior.

This allows dynamic and personalized content to be cached safely without serving incorrect responses across users.

## Configure Cookie Base Cache

You can configure this feature from the [**Medianova Control Panel**](https://cloud.medianova.com).

{% stepper %}
{% step %}
**Open the Caching Settings**

Go to **CDN → CDN Resources**, select a **Dynamic CDN Resource**, and open the **Caching** tab.
{% endstep %}

{% step %}
**Enable Cookie Base Cache**

Set **Status** to **On**.

The cookie input field becomes active.

<figure><img src="/files/HnzO9fFneKwAEU1oWNMU" alt="" width="531"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Define Cookies**

Enter the cookie name:

* **Cookie Key** — Name of the cookie to include in the cache key

Use the **+** button to add multiple cookie keys if required.
{% endstep %}

{% step %}
**Apply the Configuration**

Select **Submit** to save and apply the changes.
{% endstep %}
{% endstepper %}

* Each unique cookie value creates a **separate cache entry**.
* Cookie matching is based on the **cookie name only**; values are evaluated dynamically.
* This feature affects **cache key generation**, not cache bypass.
* Use together with **Disallow Cookie Base Cache** for advanced session-aware caching strategies.
* Adding too many cookies may increase cache fragmentation.

## Common Use Cases

* Cache dynamic pages per user role or session type
* Serve different cached responses for logged-in vs logged-out users
* Safely cache HTML or JSON responses that depend on cookie state


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://clients.medianova.com/products/performance-cdn/dynamic-content-acceleration/advanced-configuration/caching/cookie-base-cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
