Repository navigation
Fix unstyled docs pages: serve 304s for cached assets - #754
Merged
Merged
Conversation
Signed-off-by: Kristin Brown <kristin.brown@solo.io>
Nadine2016
approved these changes
Nov 23, 2026
Contributor
Docs preview
Both are uploaded Worker versions and serve no production traffic. |
sebbycorp
added a commit
that referenced
this pull request
Nov 23, 2026
Brings in the worker fix for cached /docs files (#754), so the preview stops answering revalidation requests with 404. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FeiRMhsi2TebnCBPxxRCT1 Signed-off-by: Sebastian Maniak <sebastian@maniak.io>
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.
Problem
Since #752, docs pages on kagent.dev load without CSS or JavaScript after the first visit. A hard refresh fixes one page, and the next link breaks again. The browser console shows SRI failures, with the same computed hash for every asset.
Cause
worker.mjshandles every/docs/*request. For a file request, it callsenv.ASSETS.fetch(request)and returns the result only ifexact.okis true. When the browser already has a file cached, it sendsIf-None-Match, and ASSETS answers 304 Not Modified. Becauseokonly covers 200-299, the worker treated the 304 as a miss and fell through to Next.js, which returned its 404 HTML page for every CSS and JS file.To reproduce on production:
Fix
Return the ASSETS response when it is
okor a 304.The other sites that use the same content negotiation (agentgateway.dev, kgateway.dev, aregistry.ai, ambientmesh.io) run it as a Cloudflare Pages
_worker.jsand already return 304 correctly.Testing
Not yet run locally with
npm run preview:worker. After deploy, the curl above should print304.🤖 Generated with Claude Code