Skip to content

Version static resource URLs, long-lived caching, rename icons folder - #22

Merged
codeling merged 3 commits into
mainfrom
version-static-resource-urls
Oct 3, 2026
Merged

codeling merged 3 commits into
mainfrom
version-static-resource-urls

Conversation

@codeling

@codeling codeling commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #21 and #13.

  • assetURL() / uploadURL() add ?v=<filemtime> to wiki.js, the stylesheet, icons and uploads; links and images to uploads in rendered Markdown are versioned too. All URLs honor BASE_URI.
  • Apache (.htaccess, pages/images/.htaccess) and nginx (INSTALL.md, tests/Server/nginx/w2.conf.template) send Cache-Control: max-age=31536000, immutable for .js, .css, .svg, .png and uploads.
  • icons/ is renamed to w2-icons/ so stock Apache's /icons/ alias no longer hides the icons; the alias workaround in tests/Server/run.sh is removed. index.css references internet.png relative to the stylesheet.

Note: custom CSS or files referencing /icons/... need updating. Direct links to uploads without ?v= can stay cached for up to a year after an overwrite.

Tests

  • New: AssetUrlTest (unit), BaseUriTest and a versioned-URL integration test, server tests for cache headers.
  • PHPUnit suite passes (523 tests, 45 skipped). The Docker-based server tests (tests/Server/run.sh) were not run in this environment.

🤖 Generated with Claude Code

https://claude.ai/code/session_014Vk6fuPia3n4Fc1k34555U


Generated by Claude Code

claude added 3 commits October 3, 2026 12:35
…ders

assetURL()/uploadURL() append ?v=<filemtime> to wiki.js, the stylesheet, icons
and uploads (also in rendered Markdown); .htaccess and the nginx rules send
Cache-Control: max-age=31536000, immutable for them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Vk6fuPia3n4Fc1k34555U
Icon URLs already honor BASE_URI via assetURL(); the folder rename means
stock Apache configs serve them, so the alias removal in tests/Server/run.sh
is dropped. Adds a BASE_URI (subfolder) integration test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Vk6fuPia3n4Fc1k34555U
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Vk6fuPia3n4Fc1k34555U
@codeling
codeling merged commit efe339e into main Oct 3, 2026
15 checks passed
@codeling
codeling deleted the version-static-resource-urls branch October 3, 2026 19:29
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.

Add version parameter to static resource URLs so browsers fetch updated files

2 participants