Repository navigation
Version static URLs so Cloudflare serves the new CSS - #2
Merged
Merged
Conversation
Cloudflare caches /static/ for 12 hours, so after the rewrite it kept
serving the old style.css and the map rendered 0px tall. Every
url_for('static') now gets a ?v= content hash, so a changed file gets a
new URL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLRZ1bCeX4qyg1QpD6AQFG
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.
Requested by Dan · project thread
Why
After #1 deployed, the map was blank. Cloudflare had cached the old
/static/style.css(cf-cache-status: HIT,max-age=43200), so the new layout CSS never arrived and#maprendered 0px tall. Fetching the same file with a query string returned the new CSS.What
An
url_defaultshook adds?v=<sha256 of file, 12 chars>to everyurl_for('static', ...). A changed file gets a new URL, and Cloudflare fetches it fresh. Hashes are cached per process.Testing
uv run pytest: 15 passed, including a new test for the versioned URLs. Ruff is clean.Generated by Claude Code