Every public endpoint in HD CMS sets two response headers:
Cache-Control: s-maxage=3600, stale-while-revalidate=86400
Cache-Tag: site-{siteId}
That's the entire caching strategy. Two headers. Let me explain what each does.
s-maxage=3600 tells the edge (Vercel's CDN) to cache this response for 3,600 seconds — one hour. During that hour, any request for the same URL from any visitor anywhere in the world gets the cached response instantly. No database query. No server execution. Just bytes from the nearest edge node.
stale-while-revalidate=86400 is the clever bit. After the 1-hour cache expires, the edge doesn't immediately block the next request to fetch a fresh response. Instead, it serves the stale cached response immediately (so the visitor sees content instantly) and triggers a background revalidation. The next response is fetched from the origin server asynchronously, and the cache is updated for subsequent requests.
The 86,400 seconds (24 hours) is the window during which stale content can be served while revalidating. In practice, this means a visitor will never wait for the API — they either get a fresh cached response or a stale one that's being refreshed in the background.
Notice there's no max-age set. That's deliberate. s-maxage only applies to shared caches (CDNs, edge nodes). Browsers don't cache the API responses themselves, which means when we purge the edge cache, the next browser request gets the fresh content immediately. No stale browser caches to deal with.