Bug #91886
closedNo automatic reload of changed static assets (JavaScript, css, images) in TYPO3 backend
0%
Description
When backend JavaScript files etc. change after a TYPO3 update, the following will not necessarily be enough to get them reloaded:
- "Flush cache" in Maintenance module
- relogin
- Shift-reload (e.g. CTRL-SHIFT-r)
Instead, you have to flush entire browser cache to get them reloaded.
The backend files are not loaded with a hash, for example the URL for PageTreeToolbar.js is:
/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js?bust=b9abf8dc7cadbc94540d1578ff830fba67693967
The hash-value for bust does not change, when the file changes.
Reproduce:¶
- get latest 9.5 git branch
- perform all cleanup operations (composer install, "flush cache", relogin etc.)
- open Developer Tools: console
- load the page tree
- look for a JavaScript file (e.g. PageTreeToolbar.js)
- save the URL for this file as it was loaded
Now,
- install a patch or just make a small change to the file (e.g. add console.log to file PageTreeToolbar.js line 174)
- do all actions of 2 again, but do not flush entire browser cache
- load page tree
- look at JavaScript console
- save the URL for the JS file as it was loaded
Expected result¶
After flushing cache in Maintenance and relogin, the new JavaScript file should get used in the browser and you should see the log message.
Actual result.¶
The URL for PageTreeToolbar.js is the same before and after the change.
If it is not explicitly reloaded (e.g SHIFT-reload on this URL or flush entire browser cache), the old version will still be used.
After the change, the log message will not be shown.
Only after flushing entire browser cache or shift-reloading URL for PageTreeToolbar.js (e.g. http://t3coredev9/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js?bust=b9abf8dc7cadbc94540d1578ff830fba67693967)
System¶
- TYPO3 9 (latest)
- Apache webserver
- mod_expires configuration as in default .htaccess from core
HTTP headers:
curl -I "http://t3coredev9/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js?bust=b9abf8dc7cadbc94540d1578ff830fba67693967"
...
Date: Wed, 29 Jul 2020 08:28:42 GMT
Last-Modified: Wed, 29 Jul 2020 08:02:27 GMT
Cache-Control: max-age=31536000
Expires: Thu, 29 Jul 2021 08:28:42 GMT
...
Proposed solution¶
URL of static assets should change if file changes.
Impact¶
The (current) behaviour effectively means BE users must flush their browser cache after a TYPO3 update.