For the complete documentation index, see llms.txt. This page is also available as Markdown.

Cookie Base Cache

Control CDN caching behavior by varying cache entries based on specific cookie values.

The Cookie Base Cache feature allows you to include selected cookies in the CDN cache key for Dynamic Content Acceleration resources.

By creating separate cache entries based on selected cookies, the CDN can safely cache personalized or session-aware content while maintaining cache efficiency.

This feature is available only for Dynamic CDN Resources.

When Cookie Base Cache is enabled:

  • The CDN evaluates the configured cookie names for each request.

  • Matching cookies are incorporated into the cache key according to the selected Match Mode.

  • Requests that generate different cache keys are cached separately.

  • The selected Match Mode determines how requests are handled when the configured cookie is present, empty, or missing.

This allows dynamic content to be cached without serving incorrect responses between different users or application states.

Match Modes

Each configured cookie can use one of the following match modes.

Value Required

The cookie name and value are included in the cache key.

Requests with different cookie values generate separate cache entries.

Example

Request
Cache Entry

lang=tr

Cache A

lang=en

Cache B

Use this mode when the response content depends on the cookie value, such as language selection, localization, or customer-specific content.

Existence Only

The configured cookie is evaluated when generating the cache key. If the cookie contains a value, that value contributes to the cache key.

If the cookie contains a value, different cookie values generate separate cache entries. If the cookie is present but its value is empty, the request follows the default cache behavior. Requests that do not include the configured cookie bypass cookie-based cache variation.

Example

Request
Cache Entry

feature=true

Cache A

feature=false

Cache B

feature=(empty value)

Default Cache

Cookie not present

Bypass

Use this mode when requests should continue to participate in cookie-based caching even if the cookie value is empty, while requests without the cookie should bypass cookie-based cache variation.

You can configure this feature from the Medianova Control Panel.

1

Open the Caching Settings

Go to CDN → CDN Resources, select a Dynamic CDN Resource, and open the Caching tab.

2

Set Status to On.

The cookie configuration fields become available.

3

Enter the cookie name.

Select the appropriate Match Mode:

  • Value Required

  • Existence Only

Use the + button to configure additional cookies.

4

Apply the Configuration

Select Submit to save the configuration.

Best Practices

  • Use Value Required only when response content changes based on the cookie value.

  • Use Existence Only when requests containing the configured cookie should participate in cookie-based caching and requests without the cookie should bypass cookie-based cache variation.

  • Configure only the cookies required for cache variation.

  • Excessive cookie-based cache variations may reduce cache efficiency and increase cache fragmentation.

  • This feature modifies cache key generation only and does not bypass caching.

  • Combine with Disallow Cookie Base Cache when specific requests should bypass cookie-based cache variation.

Common Use Cases

  • Cache localized pages using language cookies.

  • Cache personalized HTML responses based on user state.

  • Separate authenticated and unauthenticated content.

  • Support feature flags or A/B testing using cookie-based cache variation.

  • Cache API or JSON responses that vary by session or application state.

Last updated

Was this helpful?