forked from retoor/devplacepy
Unify static asset cache-busting with the auto-bumped app version
config.STATIC_VERSION becomes f"{APP_VERSION}-{BOOT_ID}": APP_VERSION is
read live from pyproject.toml's version (auto-bumped on every commit by
.githooks/pre-commit), BOOT_ID is the same per-process launch marker as
before (DEVPLACE_STATIC_VERSION env or a wall-clock fallback). The static
asset URL /static/v<version>/... now names the actual commit's version
alongside the boot marker, instead of a bare timestamp.
Fixes nginx/nginx.conf.template's versioned-mount location regex, which
matched digits only (^/static/v\d+/) and would have silently dropped the
immutable, max-age=31536000 cache header for every asset in production
once the version segment carried a dot or hyphen. Verified live against a
running instance that the header still applies to the new URL shape.
Updates README, devplacepy/static/js/CLAUDE.md, and the
/docs/static-caching.html page to describe the new APP_VERSION/BOOT_ID
composition.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TwLhnueWrsK15wrieXE5m7
This commit is contained in:
@@ -42,7 +42,7 @@ server {
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location ~ ^/static/v\d+/(?<asset>.+)$ {
|
||||
location ~ ^/static/v[\w.-]+/(?<asset>.+)$ {
|
||||
alias /app/static/$asset;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
expires 1y;
|
||||
|
||||
Reference in New Issue
Block a user