-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache-busting issues with static assets #21
Comments
Replace hard-coded '/asset' URL paths in templates with cache-busted URLs generated from the site's static asset manifest. See #4117
Replace hard-coded '/asset' URL paths in templates with cache-busted URLs generated from the site's static asset manifest. * Add `asset_url` helper for retrieving the cache-busted URL for an asset with a given path and use it in templates. * Fix missing entries in asset manifest by including subdirectories (eg. 'images/icons/*.svg') and all extensions (eg. sourcemaps) See #4117
Replace hard-coded '/asset' URL paths in templates with cache-busted URLs generated from the site's static asset manifest. * Add `asset_url` helper for retrieving the cache-busted URL for an asset with a given path and use it in templates. * Fix missing entries in asset manifest by including subdirectories (eg. 'images/icons/*.svg') and all extensions (eg. sourcemaps) See #4117
Replace hard-coded '/asset' URL paths in templates with cache-busted URLs generated from the site's static asset manifest. * Add `asset_url` helper for retrieving the cache-busted URL for an asset with a given path and use it in templates. * Fix missing entries in asset manifest by including subdirectories (eg. 'images/icons/*.svg') and all extensions (eg. sourcemaps) See #4117
Status update for May 2023: The code for serving static assets was extracted into the h-assets package. That still uses query strings as cache busters, but it does validate them and return a 404 if the cache buster query string is invalid. This resolves the first problem where Sentry could end up receiving a bug report for version X and end up fetching the static asset for a later release Y. However this problem is still open:
The challenge here is that the sourcemap URL is part of the JS / CSS bundle generated by Rollup or PostCSS respectively. |
Note: This issue was originally filed against the h project, before we extracted the h-assets package and started using it across different projects.
Current issues with static assets and cache busting
Not all resources are served with cache-busting tokens in the URL. eg. SVG images are currently served without. This may lead to users seeing old versions of assets.FixedProposed changes
Fix manifest.json generation in client and server to include all assets (see Fix static asset version mismatch h#4106 (comment))Fix image asset serving to include cache-busting tokens (see Fix static asset version mismatch h#4106 (comment))cache_max_age
parameter in thestatic_view
to a large value so that clients do not re-download assets that they already have.The text was updated successfully, but these errors were encountered: