---
title: "CDN caching"
description: "How the Optimi edge caches content: cache keys, TTLs, bypass rules, and safe purging."
canonical_url: https://optimi.com/en/docs/cdn-caching
md_url: https://optimi.com/en/docs/cdn-caching.md
last_updated: 2026-09-04
---

# CDN caching

Caching at the edge is the single biggest performance lever: requests answered
by the nearest edge never reach your origin. This page explains how the Optimi
cache decides what to store and for how long.

## Cache keys

A cache entry is identified by its **cache key** — by default the hostname,
path, and query string, plus the `Accept-Encoding` variant. Cookies and
authorization headers mark a response as private and bypass the cache unless a
rule explicitly allows caching.

## TTLs and origin headers

The edge honors your origin's `Cache-Control` directives: `max-age` sets the
edge TTL, `s-maxage` overrides it for shared caches, and `no-store` is always
respected. Rules can extend, shorten, or force a TTL per path pattern when the
origin sends no headers.

## Bypass rules

Some paths must always stay dynamic: admin areas, carts, checkout, and preview
URLs. Bypass rules match on path prefixes, cookies, or query parameters and
stream the response straight from the origin.

## Purging

Deploying new content? Purge by URL, by path prefix, or purge everything.
Targeted purges propagate across the edge in seconds, so prefer them over full
purges to keep the cache warm.

## Validation checklist

- Confirm the cache hit ratio rises after each rule change.
- Verify private pages never return cached content to other visitors.
- Test a targeted purge before relying on it during an incident.
