From f8bfa2b08c385649254e2d2b041da04d70d60b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Mon, 5 Dec 2022 00:13:19 +0100 Subject: [PATCH] Reorder and improve `ExpiresByType` map --- h5bp/web_performance/cache_expiration.conf | 133 ++++++--------------- 1 file changed, 39 insertions(+), 94 deletions(-) diff --git a/h5bp/web_performance/cache_expiration.conf b/h5bp/web_performance/cache_expiration.conf index 5adcd0f4..7886c6d8 100644 --- a/h5bp/web_performance/cache_expiration.conf +++ b/h5bp/web_performance/cache_expiration.conf @@ -5,7 +5,7 @@ # Serve resources with a far-future expiration date. # # (!) If you don't control versioning with filename-based cache busting, you -# should consider lowering the cache times to something like one week. +# should consider lowering the cache times to something like one week. # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires @@ -14,108 +14,53 @@ ExpiresActive on - ExpiresDefault "access plus 1 year" - - # CSS - - ExpiresByType text/css "access plus 1 year" - - - # Data interchange - - ExpiresByType application/atom+xml "access plus 1 hour" - ExpiresByType application/rdf+xml "access plus 1 hour" - ExpiresByType application/rss+xml "access plus 1 hour" - - ExpiresByType application/json "access plus 0 seconds" - ExpiresByType application/ld+json "access plus 0 seconds" - ExpiresByType application/schema+json "access plus 0 seconds" - ExpiresByType application/geo+json "access plus 0 seconds" - ExpiresByType application/xml "access plus 0 seconds" - ExpiresByType text/calendar "access plus 0 seconds" - ExpiresByType text/xml "access plus 0 seconds" + # Default: Fallback + ExpiresDefault "access plus 1 year" - # Favicon (cannot be renamed!) and cursor images - + # Specific: Assets ExpiresByType image/vnd.microsoft.icon "access plus 1 week" ExpiresByType image/x-icon "access plus 1 week" - # HTML - - ExpiresByType text/html "access plus 0 seconds" - - - # JavaScript - - ExpiresByType application/javascript "access plus 1 year" - ExpiresByType application/x-javascript "access plus 1 year" - ExpiresByType text/javascript "access plus 1 year" - - - # Manifest files - + # Specific: Manifests ExpiresByType application/manifest+json "access plus 1 week" - ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" - ExpiresByType text/cache-manifest "access plus 0 seconds" - - - # Markdown - - ExpiresByType text/markdown "access plus 0 seconds" - - - # Media files - - ExpiresByType audio/ogg "access plus 1 year" - ExpiresByType image/apng "access plus 1 year" - ExpiresByType image/avif "access plus 1 year" - ExpiresByType image/bmp "access plus 1 year" - ExpiresByType image/gif "access plus 1 year" - ExpiresByType image/jpeg "access plus 1 year" - ExpiresByType image/jxl "access plus 1 year" - ExpiresByType image/png "access plus 1 year" - ExpiresByType image/svg+xml "access plus 1 year" - ExpiresByType image/webp "access plus 1 year" - ExpiresByType video/mp4 "access plus 1 year" - ExpiresByType video/ogg "access plus 1 year" - ExpiresByType video/webm "access plus 1 year" - - - # WebAssembly - - ExpiresByType application/wasm "access plus 1 year" - - - # Web fonts - - # Collection - ExpiresByType font/collection "access plus 1 year" - - # Embedded OpenType (EOT) - ExpiresByType application/vnd.ms-fontobject "access plus 1 year" - ExpiresByType font/eot "access plus 1 year" - - # OpenType - ExpiresByType font/opentype "access plus 1 year" - ExpiresByType font/otf "access plus 1 year" - - # TrueType - ExpiresByType application/x-font-ttf "access plus 1 year" - ExpiresByType font/ttf "access plus 1 year" - - # Web Open Font Format (WOFF) 1.0 - ExpiresByType application/font-woff "access plus 1 year" - ExpiresByType application/x-font-woff "access plus 1 year" - ExpiresByType font/woff "access plus 1 year" - - # Web Open Font Format (WOFF) 2.0 - ExpiresByType application/font-woff2 "access plus 1 year" - ExpiresByType font/woff2 "access plus 1 year" + ExpiresByType application/x-web-app-manifest+json "access" + ExpiresByType text/cache-manifest "access" + # Specific: Data interchange + ExpiresByType application/atom+xml "access plus 1 hour" + ExpiresByType application/rdf+xml "access plus 1 hour" + ExpiresByType application/rss+xml "access plus 1 hour" - # Other + # Specific: Documents + ExpiresByType text/html "access" + ExpiresByType text/markdown "access" + ExpiresByType text/calendar "access" + # Specific: Other ExpiresByType text/x-cross-domain-policy "access plus 1 week" + # Generic: Data + ExpiresByType application/json "access" + ExpiresByType application/ld+json "access" + ExpiresByType application/schema+json "access" + ExpiresByType application/geo+json "access" + ExpiresByType application/xml "access" + ExpiresByType text/xml "access" + + # Generic: WebAssembly + # ExpiresByType application/wasm "access plus 1 year" # default + + # Generic: Assets + # ExpiresByType application/javascript "access plus 1 year" # default + # ExpiresByType application/x-javascript "access plus 1 year" # default + # ExpiresByType text/javascript "access plus 1 year" # default + # ExpiresByType text/css "access plus 1 year" # default + + # Generic: Medias + # ExpiresByType audio/* "access plus 1 year" # default + # ExpiresByType image/* "access plus 1 year" # default + # ExpiresByType video/* "access plus 1 year" # default + # ExpiresByType font/* "access plus 1 year" # default +