# 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="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2Fo6D2oLjyXAc8R09SMc2h%2Fimage.png?alt=media&#x26;token=d30d40ae-db6b-481d-93c4-1f89b04f9bdc" 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
