Skip to content

Version static URLs so Cloudflare serves the new CSS - #2

Merged
dbader merged 1 commit into
masterfrom
claude/project-thread-pm5duv
Dec 3, 2026
Merged

dbader merged 1 commit into
masterfrom
claude/project-thread-pm5duv

Conversation

@dbader

@dbader dbader commented Dec 3, 2026

Copy link
Copy Markdown
Member

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 #map rendered 0px tall. Fetching the same file with a query string returned the new CSS.

What

An url_defaults hook adds ?v=<sha256 of file, 12 chars> to every url_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

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
@dbader dbader self-assigned this Dec 3, 2026
@dbader
dbader merged commit 8da2bbc into master Dec 3, 2026
1 check 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.

2 participants