Caching Marketing Pages

Which requests the edge cache serves, why some visitors get a live render, when edits appear, and the trade-offs of analytics and embeds.

Marketing pages are prerendered and served from Void's ISR cache (routing.isr: true in apps/web/void.config.ts). The cache only serves some requests; everyone else gets a live render with the full security headers.

This page is part of the Marketing documentation.

Which Requests Are Cached

A request is served from, and stored in, the cache when all of these hold:

  • the page is in pages/(marketing)/ (decided by apps/web/lib/cacheable-routes.server.ts);
  • the URL has no locale prefix (/faq, not /it/faq): Void picks the cache lifetime before the locale rewrite, so prefixed URLs are never stored and keep their CSP;
  • the request has no Cookie, Authorization or Cf-Access-Jwt-Assertion header (even an empty one);
  • the response is a 200 that sets no cookie, has no private, no-store or no-cache, and no Vary.

Those responses carry no CSP and no nonce (a nonce can't be shared between visitors). Every other request, including a signed-in visit to /, renders live with the nonce CSP. Details: Cached Marketing Pages.

Void skips the cache for any request with a Cookie header. So the cache serves first visits and crawlers; a returning visitor who has a session, a saved language or theme, or any other cookie on your domain gets a live render. That's correct (their header shows Dashboard, their theme) and still fast, but it isn't cached.

Anything that sets a cookie on your domain (an analytics script, a chat widget, an A/B test) turns caching off for that visitor's later requests. Prefer cookieless tools if the cache matters to you.

When Edits Appear

Cached pages last a year or until the next deploy; deploys clear the cache. Edits to copy, links, the FAQ or the legal Markdown appear after you deploy, not before. There is nothing to purge by hand. A content collection from a CMS (kind: 'remote' in config/content.config.ts) is the exception: its pages are cached for its maxAge and then rendered again with the CMS's latest entries.

Analytics and Embeds

You may add analytics scripts or embeds (video, maps) to marketing pages; they stay cacheable. Script tags run for everyone (cookieless responses have no CSP; the rest get the nonce automatically). The trade-offs:

  • CSP sources: add the script's request, image and frame origins to apps/web/config/security.config.ts → csp, or they're blocked for visitors with cookies. Test with pnpm preview and a cookie set; pnpm dev sends no CSP.
  • Cookies: a script that sets cookies disables the cache for returning visitors (above), and usually needs consent and a line in the cookie policy.
  • Undo: remove the script and its CSP sources; nothing else changes.

Turning Caching Off

There's no per-page switch: move a page out of pages/(marketing)/ and it renders live with the nonce CSP, like any other page. To give up the cache for the whole site, set routing: { isr: false } in apps/web/void.config.ts: marketing pages then render on every request, each costing a Worker render instead of a cache read. Note that the security middleware still sends no CSP to visitors without cookies on pages/(marketing)/, so without the cache you lose the CSP and gain nothing: move the pages out of the folder as well. Set it back to true to restore caching.

Checking It

  • pnpm test:e2e checks every marketing page without cookies: no Set-Cookie or private, the same HTML whatever host is sent, identical shared data with no user and no nonce.
  • pnpm preview has no ISR cache, so locally every request renders. After a deploy, a request without cookies to / should show x-isr-cache: HIT; the first one may show MISS if the deploy didn't prerender the page, and the next one HIT.

Next: Blog and Changelog →