From 3279a4403c22237f76cee1b21ce2982b41cbe41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Sun, 4 Dec 2022 23:36:10 +0100 Subject: [PATCH] Reorder and improve `expires` map --- h5bp/web_performance/cache_expiration.conf | 79 +++++++++------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/h5bp/web_performance/cache_expiration.conf b/h5bp/web_performance/cache_expiration.conf index 2cb330f..3f3fa4e 100644 --- a/h5bp/web_performance/cache_expiration.conf +++ b/h5bp/web_performance/cache_expiration.conf @@ -12,65 +12,52 @@ # https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires map $sent_http_content_type $expires { + # Default: Fallback default 1y; - # No content + # Default: No content "" off; - # CSS - ~*text/css 1y; + # Specific: Assets + ~*image/svg\+xml 1y; + ~*image/vnd.microsoft.icon 1w; + ~*image/x-icon 1w; - # Data interchange + # Specific: Manifests + ~*application/manifest\+json 1w; + ~*text/cache-manifest epoch; + + # Specific: Data interchange ~*application/atom\+xml 1h; ~*application/rdf\+xml 1h; ~*application/rss\+xml 1h; - ~*application/json epoch; - ~*application/ld\+json epoch; - ~*application/schema\+json epoch; - ~*application/geo\+json epoch; - ~*application/xml epoch; - ~*text/calendar epoch; - ~*text/xml epoch; - - # Favicon (cannot be renamed!) and cursor images - ~*image/vnd.microsoft.icon 1w; - ~*image/x-icon 1w; - - # HTML + # Specific: Documents ~*text/html epoch; - - # JavaScript - ~*application/javascript 1y; - ~*application/x-javascript 1y; - ~*text/javascript 1y; - - # Manifest files - ~*application/manifest\+json 1w; - ~*application/x-web-app-manifest\+json epoch; - ~*text/cache-manifest epoch; - - # Markdown ~*text/markdown epoch; + ~*text/calendar epoch; - # Media files - ~*audio/ 1y; - ~*image/ 1y; - ~*video/ 1y; - - # WebAssembly - ~*application/wasm 1y; - - # Web fonts - ~*font/ 1y; - ~*application/vnd.ms-fontobject 1y; - ~*application/x-font-ttf 1y; - ~*application/x-font-woff 1y; - ~*application/font-woff 1y; - ~*application/font-woff2 1y; - - # Other + # Specific: Other ~*text/x-cross-domain-policy 1w; + + # Generic: Data + ~*json epoch; + ~*xml epoch; + + # Generic: WebAssembly + # ~*application/wasm 1y; # default + + # Generic: Assets + # ~*application/javascript 1y; # default + # ~*application/x-javascript 1y; # default + # ~*text/javascript 1y; # default + # ~*text/css 1y; # default + + # Generic: Medias + # ~*audio/ 1y; # default + # ~*image/ 1y; # default + # ~*video/ 1y; # default + # ~*font/ 1y; # default } expires $expires;