> 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/dynamic-content-acceleration/advanced-configuration/caching/cookie-base-cache.md).

# Cookie Base Cache

Cookie Base Cache includes selected cookies in the CDN cache key to create separate cached responses for different application states on Dynamic CDN Resources.

{% 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 evaluates the configured cookies for each request.
* Each configured cookie contributes to the cache key according to its **Match Mode**.
* Different cookie values can generate separate cache entries.
* **Bypass Cache when no cookie is present** determines whether requests that do not contain any of the configured cookies bypass the cache.

### Match Modes

Each configured cookie uses one of the following Match Modes.

#### **Value Required**

**Value Required** includes the cookie name and value in the cache key. Different cookie values generate separate cache entries.

**Example**

| Request   | Cache Entry |
| --------- | ----------- |
| `lang=tr` | Cache A     |
| `lang=en` | Cache B     |

Use this mode when response content varies according to the cookie value, such as language selection, localization, or application state.

#### **Existence Only**

**Existence Only** keeps a request eligible for caching when the configured cookie is present without a value. Different non-empty cookie values continue to generate separate cache entries.

**Example**

| Request         | Cache Behavior                                      |
| --------------- | --------------------------------------------------- |
| `feature=true`  | Cached using the configured cookie value            |
| `feature=false` | Cached separately using the configured cookie value |
| `feature=`      | Remains eligible for caching                        |

### Bypass Cache When No Cookie Is Present

**Bypass Cache when no cookie is present** controls how requests that do not contain any of the configured cookies are handled.

<table><thead><tr><th width="136.6666259765625">Setting</th><th>Behavior</th></tr></thead><tbody><tr><td><strong>Enabled</strong></td><td>Requests without any configured cookies bypass the cache.</td></tr><tr><td><strong>Disabled</strong></td><td>Requests without any configured cookies do not bypass the cache because of this setting.</td></tr></tbody></table>

Requests containing configured cookies continue to use cookie-based cache keys according to their configured **Match Mode**.

## Configure Cookie Base Cache

Configure Cookie Base Cache 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.

<figure><img src="/files/M1Bah8cgv39LaR85FDlK" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Enable Cookie Base Cache

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

The cookie configuration fields and **Bypass Cache when no cookie is present** setting become available.
{% endstep %}

{% step %}

### Configure Bypass Cache When No Cookie Is Present

Set **Bypass Cache when no cookie is present** according to how requests without any configured cookies should be handled:

* Enable **Bypass Cache when no cookie is present** to bypass the cache when a request does not contain any of the configured cookies.
* Disable **Bypass Cache when no cookie is present** so that the absence of configured cookies does not cause the request to bypass the cache.

This setting does not change the Match Mode configured for cookies in Cookie Base Cache.
{% endstep %}

{% step %}

### Add a Cookie

Enter the cookie name and select a **Match Mode**:

* **Value Required**
* **Existence Only**

Use the **+** control to configure additional cookies.
{% endstep %}

{% step %}

### Apply the Configuration

Select **Submit** to save the configuration.
{% endstep %}
{% endstepper %}

## Best Practices

* Configure only cookies that affect the response content.
* Use **Value Required** when different cookie values require separate cached responses.
* Use **Existence Only** when a request should remain cacheable if the configured cookie is present without a value.
* Avoid unnecessary or highly variable cookies because they can increase cache fragmentation and reduce cache efficiency.
* Combine Cookie Base Cache with **Disallow Cookie Base Cache** when specific cookie-based requests must bypass caching.

## Common Use Cases

### Cache Localized Content

Configure a language cookie when the response varies by the user's selected language. Different language values generate separate cache entries.

### Cache Content Based on Application State

Include cookies that affect the generated response to prevent different application states from sharing the same cached response.

### Bypass Requests Without Configured Cookies

Enable **Bypass Cache when no cookie is present** when requests that do not contain any of the configured cookies should bypass caching.

### Allow Requests Without Configured Cookies

Disable **Bypass Cache when no cookie is present** when the absence of configured cookies should not, by itself, cause a request to bypass caching.


---

# 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
