From abcd39107b7623c639c0c8609d1f45a22a8a2785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 22 Sep 2026 09:32:15 +0200 Subject: [PATCH] fix: serve css/js via cdn --- public/typo3conf/AdditionalConfiguration.php | 5 +++++ .../TypoScript/Extensions/Replacer.typoscript | 10 ++++++++-- .../TypoScript/Extensions/Typo3Encore.typoscript | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/typo3conf/AdditionalConfiguration.php b/public/typo3conf/AdditionalConfiguration.php index 03f1447a..82a170c6 100644 --- a/public/typo3conf/AdditionalConfiguration.php +++ b/public/typo3conf/AdditionalConfiguration.php @@ -85,6 +85,11 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline'] 'groups' => ['pages'], ]; +// Assets are served through the bunny.net CDN, which gzip/brotli-compresses at the edge. +// Pre-gzipped .gzip twins are served with Content-Encoding: gzip and cannot be processed +// by the CDN, so stop generating them. mod_deflate still compresses direct origin hits. +$GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 0; + // suppress php deprecation warnings flooding typo3 logs $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] & ~E_DEPRECATED & ~E_USER_DEPRECATED; diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Replacer.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Replacer.typoscript index 770c49bc..6a7942de 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Replacer.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Replacer.typoscript @@ -1,10 +1,16 @@ config.tx_replacer { enable_regex = 1 + + # The quote character is captured rather than matched literally, because the + # @font-face block in Page/Main.typoscript writes its url() values with single + # quotes - anchoring on `"` alone would skip every font. + # typo3conf is scoped to ep_theme/Resources/Public on purpose: it keeps other + # extensions, Configuration/ and Resources/Private/ out of the CDN. search { - 10 = /"\/?(fileadmin|typo3temp|uploads)/ + 10 = /(["'])\/?(fileadmin|typo3temp|uploads|typo3conf\/ext\/ep_theme\/Resources\/Public)/ } replace { - 10 = "https://cdn.ep-reisen.de/$1 + 10 = $1https://cdn.ep-reisen.de/$2 } } diff --git a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Typo3Encore.typoscript b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Typo3Encore.typoscript index 17c346f1..0a5e4900 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Typo3Encore.typoscript +++ b/public/typo3conf/ext/ep_theme/Configuration/TypoScript/Extensions/Typo3Encore.typoscript @@ -5,5 +5,6 @@ plugin.tx_typo3encore { builds { EpThemeConfig = EXT:ep_theme/Resources/Public } + preload.enable = 0 } -} \ No newline at end of file +}