refactor: add svg to rewrite rule for TYPO3#7482
Conversation
|
Thanks for your contribution @dhuf ! Could you please edit your OP to give more context? I'm afraid your short intro doesn't say enough.
|
|
Download the artifacts for this pull request:
See Testing a PR. |
|
@rfay hope that helps, the config is already there for all other filetypes. The svg is only missing |
|
You're making progress, thanks. You have a ways to go. Remember we aren't even familiar with the TYPO3 upgrade page or what might happen there. So you say
But you don't say how to see it. Maybe a screenshot of before and after? In your testing instructions you say "It can easily be tested" but you don't say how to test or how to verify that the fix works. |
|
If it's easier for you, just record a tiny screencast showing the problem and the fix, thanks. |
|
Hi @rfay, sorry, I was on Holiday, I'll try to do it as soon as possible. Thanks so much |
SVG are not rewriten Example in the backend: /_assets/6104b7f46d656dcf567ead154886bf37/Icons/modules/install-update.1753364958.svg
Detailed Manual Testing StrategyTest Environment Setupmkdir test-typo3-svg && cd test-typo3-svg
ddev config --project-type=typo3 --php-version=8.2
ddev start
ddev composer create "typo3/cms-base-distribution:^13"Enable versionNumberInFilenameCreate <?php
$GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename'] = 1;Test Case: SVG File Timestamp Rewriting
Actual Test ResultsBefore applying the fix:
After applying the nginx config change (adding Verification
Real-World ImpactThis fix ensures TYPO3's Code Change ValidationThe modification is minimal and safe - only adds - rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ /$1.$3 last;
+ rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|svg|gzip)$ /$1.$3 last;LGTM 👍 This fix resolves a real issue with SVG asset handling in TYPO3 projects using timestamp-based cache busting. |
|
Hi @rfay, thank you so much for the comments and reviewing. Yes, that is probably also needed for Apache. Where is the configuration for TYPO3 in DDEV located ? |
After copying that file to We can copy or download the file, but maintaining it isn't ideal, especially with several active TYPO3 major versions. Pulling the latest version isn't reliable either, though pulling a tagged version is possible. I don't think DDEV should manage this when using Apache, especially since it's an optional feature and clearly documented. The nginx update makes sense, though. |
The Issue
To avoid browser to cache resources, timestamps are used for cache busting.
In the default nginx configuration the cache busting config is there but missing for SVG files.
TYPO3 docs: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/Typo3ConfVars/FE.html#confval-typo3-conf-vars-fe-versionnumberinfilename
This can easily be seen on the TYPO3 Upgrade page /typo3/module/tools/upgrade if the BE|versionNumberInFilename is activated to use that cache busting in the BE.
This removes the timestamp:
/_assets/6104b7f46d656dcf567ead154886bf37/Icons/modules/install-wizards.1753364958.svg
to
/_assets/6104b7f46d656dcf567ead154886bf37/Icons/modules/install-wizards.svg
How This PR Solves The Issue
It simply adds the rewrite also for the SVG
Manual Testing Instructions
This can easily be tested on the TYPO3 Upgrade page /typo3/module/tools/upgrade if the BE|versionNumberInFilename is activated to use that cache busting in the BE.