Repository navigation
fix(astro-renderer): vary site Worker responses by host - #63
Merged
Merged
Conversation
Workers Cache keys by path, not hostname, and answers before the Worker runs. Every host routed to one site Worker shared one cache entry per path: a redirect host's 301 (#49) was served on the site's own domain (a loop on cloudhal.com's home page), and RFC-0034's multi-site Workers could serve one site's cached page on another site's host. - Every response from the site Worker carries `Vary: Host` (merged into an existing Vary), so the cache keeps one variant per host. - Redirect-host 301s are `cloudflare-cdn-cache-control: no-store`. - RFC-0034: corrected the "cache key contains the host" assumption. Verified on a test deployment with two custom domains: before, the 301 and the 200 leaked between hosts in both orders; after, each host gets its own answer, and the site's pages are still cached (HIT). Fixes #62 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #62.
Workers Cache keys by path, not hostname, and answers before the Worker runs (docs). Every host routed to one site Worker therefore shared one cache entry per path.
Vary: Host(merged into an existingVary;Vary: *left alone) —cache-vary.ts, applied once increateSiteWorker'sfetch.cloudflare-cdn-cache-control: no-storeas well.Verified on a real deployment
A throwaway deployment with two custom domains,
cachetest.cloudhal.dev(site) andcachetest-www.cloudhal.dev(redirect), purged before each order:/301 MISS, site301 HIT(loop)301 BYPASS, site200/200, www200 HIT(no redirect)200, www301 BYPASS/repeatedHITHITafter the first fills (agegrows)Tests:
cache-vary.test.ts,host-redirect.test.ts; astro-renderer suite 255/255.🤖 Generated with Claude Code