Repository navigation
Conversation
index.html names the hashed JS/CSS bundles of the current build. It was served with Cache-Control: max-age=360 and Last-Modified 1980 (the build gives every file that time), and clastic answered every "changed since?" check with 304. Browsers kept an old index.html that pointed at bundles a deploy had removed, so coordinators and jurors got a blank page until they hard-refreshed. Serve / and /a/ through IndexFileRoute: cache_timeout=0, so clastic skips the modification-time check and sends the file, plus Cache-Control: no-cache. The hashed bundles stay cacheable. Browsers that hold a stale copy get the new page on their next normal reload. Adds a test (304 before the fix). Fixes #643. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #643.
index.htmlnames the hashed JS and CSS bundles of the current build. It was served withCache-Control: max-age=360andLast-Modified: 1 Jan 1980(the build gives every file that date), and clastic'sStaticFileRouteanswers a "changed since?" check by comparing with that date, so it said 304 every time. Browsers kept an oldindex.htmlthat pointed at bundles the deploy had removed: a blank page until a hard refresh. The ETag middleware didn't help, because it skips streamed file responses./and/a/are now served by a smallIndexFileRoute:cache_timeout=0, so clastic skips the date check and sends the file (about 1 KB), plusCache-Control: no-cache. The hashed bundles under/assets/are unchanged and stay cacheable. The frontend uses hash routing, so every app page loads through/.A browser that already holds a stale copy gets the new page on its next normal reload, once this is deployed.
Tests
test_index_html_is_never_stale:/and/a/with anIf-Modified-Sincein the future answer 200 with the page andno-cache. It fails on master with 304.curl:/and/a/answerCache-Control: max-age=0, no-cache, and a request withIf-Modified-Sincein 2100 gets 200 with the page (before:max-age=360and 304). The bundles under/assets/still havemax-age=360.Written by Claude (Claude Code) on behalf of @lgelauff.
🤖 Generated with Claude Code