feat: integrate with ext:static_filecache

This commit is contained in:
Björn Fromme
2024-02-26 13:21:09 +01:00
parent 38dca63e0d
commit 80677ef97f
3 changed files with 259 additions and 1 deletions
+1
View File
@@ -26,6 +26,7 @@
"kigkonsult/icalcreator": "^2.29", "kigkonsult/icalcreator": "^2.29",
"league/csv": "^9.2", "league/csv": "^9.2",
"league/period": "^4.9", "league/period": "^4.9",
"lochmueller/staticfilecache": "^12.5",
"ssch/typo3-encore": "^3.0", "ssch/typo3-encore": "^3.0",
"symfony/http-client": "^4.3", "symfony/http-client": "^4.3",
"symfony/options-resolver": "^4.2", "symfony/options-resolver": "^4.2",
Generated
+90 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c893e726cae59c3033fd05e61f83cb75", "content-hash": "25f76f1685e8ee310648c90e4c0af0f8",
"packages": [ "packages": [
{ {
"name": "b13/container", "name": "b13/container",
@@ -1771,6 +1771,95 @@
], ],
"time": "2022-02-21T08:41:21+00:00" "time": "2022-02-21T08:41:21+00:00"
}, },
{
"name": "lochmueller/staticfilecache",
"version": "12.5.0",
"source": {
"type": "git",
"url": "https://github.com/lochmueller/staticfilecache.git",
"reference": "68163d7a0f1f16a1d3855b8212b8fa5682d9ae0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lochmueller/staticfilecache/zipball/68163d7a0f1f16a1d3855b8212b8fa5682d9ae0b",
"reference": "68163d7a0f1f16a1d3855b8212b8fa5682d9ae0b",
"shasum": ""
},
"require": {
"ext-pdo": "*",
"ext-zlib": "*",
"php": "^7.4||^8.0",
"typo3/cms-core": "^10.4.21||^11.5.2",
"typo3/cms-extensionmanager": "^10.4.21||^11.5.2"
},
"conflict": {
"tomasnorre/crawler": "<11.0.1"
},
"replace": {
"typo3-ter/staticfilecache": "self.version"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.5",
"phpmetrics/phpmetrics": "^2.5",
"typo3/testing-framework": "^6.1"
},
"suggest": {
"friendsofsymfony/http-cache": "For HTTP proxy cache services like Varnish",
"lochmueller/seocli": "Scan websites against SEO criteria and/or trigger the indexing process and cache warming in deployment scripts"
},
"type": "typo3-cms-extension",
"extra": {
"typo3/cms": {
"extension-key": "staticfilecache",
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": ".Build/Web"
}
},
"autoload": {
"psr-4": {
"SFC\\Staticfilecache\\": "Classes"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Tim Lochmüller",
"email": "[email protected]",
"homepage": "https://github.com/lochmueller",
"role": "Developer"
}
],
"description": "Transparent static file cache solution using mod_rewrite and mod_expires. Increase performance for static pages by a factor of 230!!",
"homepage": "https://extensions.typo3.org/extension/staticfilecache",
"keywords": [
"StaticFileCache",
"TYPO3 CMS",
"cache",
"file",
"magic",
"speed",
"static"
],
"support": {
"docs": "https://docs.typo3.org/p/lochmueller/staticfilecache/main/en-us/",
"issues": "https://github.com/lochmueller/staticfilecache/issues",
"source": "https://github.com/lochmueller/staticfilecache"
},
"funding": [
{
"url": "https://paypal.me/lochmueller",
"type": "custom"
},
{
"url": "https://github.com/lochmueller",
"type": "github"
}
],
"time": "2022-08-26T13:35:21+00:00"
},
{ {
"name": "lolli42/finediff", "name": "lolli42/finediff",
"version": "1.0.3", "version": "1.0.3",
+168
View File
@@ -287,6 +287,174 @@ AddDefaultCharset utf-8
RewriteCond %{REQUEST_FILENAME}\.webp -f RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp] RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]
### Begin: StaticFileCache (preparation) ####
# Document root configuration
RewriteRule .* - [E=SFC_ROOT:%{DOCUMENT_ROOT}]
# RewriteRule .* - [E=SFC_ROOT:%{DOCUMENT_ROOT}/t3site] # Example if your installation is installed in a directory
# NOTE: There are cases (apache versions and configuration) where DOCUMENT_ROOT do not exists. Please set the SFC_ROOT to the right directory without DOCUMENT_ROOT then!
# Cleanup URI
RewriteCond %{REQUEST_URI} ^.*$
RewriteRule .* - [E=SFC_URI:/%{REQUEST_URI}]
RewriteCond %{REQUEST_URI} ^/.*$
RewriteRule .* - [E=SFC_URI:%{REQUEST_URI}]
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule .* - [E=SFC_URI:/]
# Cleanup HOST
RewriteCond %{HTTP_HOST} ^([^:]+)(:[0-9]+)?$
RewriteRule .* - [E=SFC_HOST:%1]
# Disable cache for EXT:solr indexing requests
RewriteCond %{HTTP:X-Tx-Solr-Iq} .+
RewriteRule .* - [E=SFC_HOST:invalid-host]
# Get scheme
RewriteRule .* - [E=SFC_PROTOCOL:http]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=SFC_PROTOCOL:https]
# Get port
RewriteRule .* - [E=SFC_PORT:80]
RewriteCond %{ENV:SFC_PROTOCOL} ^https$ [NC]
RewriteRule .* - [E=SFC_PORT:443]
RewriteCond %{SERVER_PORT} ^[0-9]+$
RewriteRule .* - [E=SFC_PORT:%{SERVER_PORT}]
RewriteCond %{HTTP:X-Forwarded-Port} ^[0-9]+$
RewriteRule .* - [E=SFC_PORT:%{HTTP:X-Forwarded-Port}]
# Full path for redirect
RewriteRule .* - [E=SFC_FULLPATH:typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}_%{ENV:SFC_HOST}_%{ENV:SFC_PORT}%{ENV:SFC_URI}/index]
# Extension (Order: br, gzip, default)
RewriteRule .* - [E=SFC_EXT:]
RewriteCond %{HTTP:Accept-Encoding} br [NC]
RewriteRule .* - [E=SFC_EXT:.br]
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT} !-f
RewriteRule .* - [E=SFC_EXT:]
RewriteCond %{ENV:SFC_EXT} ^$
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteRule .* - [E=SFC_EXT:.gz]
RewriteCond %{ENV:SFC_EXT} ^\.gz$
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT} !-f
RewriteRule .* - [E=SFC_EXT:]
# Write Extension to SFC_FULLPATH
RewriteRule .* - [E=SFC_FULLPATH:%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT}]
### Begin: StaticFileCache (main) ####
# We only redirect URI's without query strings
RewriteCond %{QUERY_STRING} ^$
# It only makes sense to do the other checks if a static file actually exists.
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH} -f
# NO frontend or backend user is logged in. Logged in users may see different
# information than anonymous users. But the anonymous version is cached. So
# don't show the anonymous version to logged in users.
RewriteCond %{HTTP_COOKIE} !staticfilecache [NC]
# We only redirect GET requests
RewriteCond %{REQUEST_METHOD} GET
# Rewrite the request to the static file.
RewriteRule .* %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH} [L]
# Do not allow direct call the cache entries
RewriteCond %{ENV:SFC_URI} ^/typo3temp/tx_staticfilecache/.*
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule .* - [F,L]
# Handle application cache
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*\.sfc$ %{ENV:CWD}index.php?eID=sfc_manifest [QSA,L]
### Begin: StaticFileCache (options) ####
# Set proper content type and encoding for gzipped html.
<FilesMatch "\.gzip$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding gzip
</IfModule>
</FilesMatch>
<FilesMatch "\.gz$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding gzip
</IfModule>
</FilesMatch>
<FilesMatch "\.br$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding br
</IfModule>
</FilesMatch>
# if there are same problems with ForceType, please try the AddType alternative
# Set proper content type gzipped html
<FilesMatch "\.gzip$">
ForceType text/html
# AddType "text/html" .gzip
</FilesMatch>
<FilesMatch "\.js\.gzip$">
ForceType text/javascript
# AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
ForceType text/css
# AddType "text/css" .gzip
</FilesMatch>
<FilesMatch "\.xml\.gzip$">
ForceType text/xml
# AddType "text/xml" .gzip
</FilesMatch>
<FilesMatch "\.rss\.gzip$">
ForceType text/xml
# AddType "text/xml" .gzip
</FilesMatch>
<FilesMatch "\.gz$">
ForceType text/html
# AddType "text/html" .gz
</FilesMatch>
<FilesMatch "\.xml\.gz$">
ForceType text/xml
# AddType "text/xml" .gz
</FilesMatch>
<FilesMatch "\.rss\.gz$">
ForceType text/xml
# AddType "text/xml" .gz
</FilesMatch>
<FilesMatch "\.br$">
ForceType text/html
# AddType "text/html" .br
</FilesMatch>
<FilesMatch "\.xml\.br$">
ForceType text/xml
# AddType "text/xml" .br
</FilesMatch>
<FilesMatch "\.rss\.br$">
ForceType text/xml
# AddType "text/xml" .br
</FilesMatch>
# Avoid .br files being delivered with Content-Language: br headers
<IfModule mod_mime.c>
RemoveLanguage .br
</IfModule>
### End: StaticFileCache ###
# If the file/symlink/directory does not exist => Redirect to index.php. # If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'. # For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f