Skip to content

fix: serve mutable docs HTML directly from R2 - #144

Merged
hannesrudolph merged 1 commit into
mainfrom
fix/html-cache-freshness
Aug 30, 2026
Merged

hannesrudolph merged 1 commit into
mainfrom
fix/html-cache-freshness

Conversation

@hannesrudolph

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where a changed docs page can remain stale at its canonical URL after a successful R2 deployment. The v2026.8.1 Markdown endpoint and cache-busted HTML returned the current page, while the normal HTML URL continued returning an older caches.default entry with immutable cache headers.

Why This Change Was Made

Mutable HTML and slashless HTML aliases now bypass the Worker Cache API and read directly from the native R2 binding. Static assets, Markdown, and other non-HTML responses keep Worker caching. The minute-suffixed HTML cache key and the unusable purge workflow are removed; the protected token could resolve the zone but Cloudflare rejected purge with 401 Authentication error because it lacks Cache Purge permission.

This follows Cloudflare’s documented boundary that URL purge cannot invalidate Cache API entries whose custom key was set by a Worker. It restores freshness without requiring broader Cloudflare access, tag infrastructure, or a zone-wide purge.

User Impact

Updated documentation becomes visible at its stable HTML URL as soon as the R2 object changes. Maintainers no longer need personal Cloudflare dashboard access or a separate cache-purge credential to publish a corrected page.

Evidence

  • Live reproduction before the fix
    • canonical v2026.8.1 HTML returned the old page with X-OpenClaw-Docs-Cache: HIT
    • the Markdown endpoint and cache-busted HTML returned the current 16,304-source page
    • the merged prefix purge reached the zone but Cloudflare rejected the purge endpoint with HTTP 401
  • npm test — 48/48 tests passed
  • npx [email protected] deploy --dry-run --config wrangler.toml — passed
  • make docs-check
    • full 30,573-page build passed
    • R2 preparation produced 85,632 objects
    • full routing and docs smoke checks passed
  • npm run docs:visual — passed

@hannesrudolph
hannesrudolph marked this pull request as ready for review August 30, 2026 23:34
@hannesrudolph
hannesrudolph requested a review from a team as a code owner August 30, 2026 23:34
@hannesrudolph
hannesrudolph merged commit ae1cf8d into main Aug 30, 2026
6 checks passed
@hannesrudolph
hannesrudolph deleted the fix/html-cache-freshness branch August 30, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant