Performance & Edge

Cache-Control Headers

Direct Definition

Cache-Control is an HTTP response header that tells browsers, CDNs, and proxies whether and how long a response may be cached. Directives such as max-age, s-maxage, private, no-store, and stale-while-revalidate control freshness and sharing for every cached copy.

Technical Architecture & Deep-Dive

Caching behavior is negotiated through headers. `max-age=60` lets any cache reuse a response for 60 seconds, `s-maxage` applies only to shared caches like CDNs, and `private` restricts caching to the end user browser. `no-store` forbids caching entirely, which is essential for sensitive data.

Edge gateways can override or add Cache-Control headers on third-party API responses that lack them, enabling safe caching of public data while ensuring personalized responses are never shared between users.

Key Architectural Benefits

Gives precise control over browser and CDN caching behavior.
Prevents sensitive personalized data from being cached publicly.
Enables stale-while-revalidate for fast yet fresh responses.

Edge-Cacheable API Response Header

http
Cache-Control: public, max-age=30, s-maxage=300, stale-while-revalidate=600
REALCOMPOSER EDGE WORKSPACE

Implement Cache-Control Headers at the Edge

Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.

START BUILDING FREE

Frequently Asked Questions

Q:What is the difference between max-age and s-maxage?

max-age applies to all caches including browsers. s-maxage overrides it for shared caches such as CDNs and edge proxies only.

Related Architecture Concepts

Ready-to-Use Edge Recipes