Skip to content

Use Cloudflare Cache API for actual edge caching#5

Merged
gavyncaldwell merged 1 commit intomainfrom
fix/edge-cache-api
Mar 13, 2026
Merged

Use Cloudflare Cache API for actual edge caching#5
gavyncaldwell merged 1 commit intomainfrom
fix/edge-cache-api

Conversation

@gavyncaldwell
Copy link
Collaborator

Summary

  • s-maxage headers alone do nothing on Workers — responses bypass Cloudflare's HTTP cache by default
  • Now explicitly storing responses in edge cache via caches.default.put(), same pattern already used by icon proxy
  • Covers all page routes, sitemaps, and robots.txt
  • On cache hit, returns immediately with zero Turso reads

Context

After deploying the 1-week cache TTLs in #3, Turso reads were still at 25M because the cache headers weren't being read by anything — every request was still hitting the worker and Turso. This is the actual fix.

s-maxage headers alone do nothing on Workers — responses bypass
Cloudflare's HTTP cache by default. Now explicitly storing responses
in edge cache via caches.default, same pattern as icon proxy.

Covers all page routes, sitemaps, and robots.txt.
@gavyncaldwell gavyncaldwell merged commit 663d2a5 into main Mar 13, 2026
1 of 2 checks passed
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