Discussions

Ask a Question
Back to all

Cache strategy for docs pages generated from PDF sources at build time

We publish a set of reference documents that upstream vendors only give us as PDFs. Our docs pipeline converts each one to Markdown at build time and pushes the rendered HTML to the CDN, and I am trying to work out the right cache strategy for that output.

The conversion itself runs client-side in a browser step — we use pdf2md so the source files never leave our build machine — and it is deterministic, so the same PDF always yields byte-identical Markdown. That gives us a stable ETag derived from the source hash.

Two questions about how Mlytics handles this:

  1. If we set a long max-age and rely on a purge-on-publish hook, is there a recommended granularity for the purge call? Per-path, or is a tag-based purge better when one source document expands into forty rendered pages?
  2. Does the edge honour a stale-while-revalidate directive on HTML responses, or is it only applied to static assets? The docs pages are cheap to regenerate but we would rather not serve a miss during a rebuild.

Happy to be pointed at existing docs if this is covered somewhere I missed.