From fd84b1f429245e1b9e62e5620c8c5ac4a311f4c9 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 15 Nov 2016 15:46:34 +0200 Subject: [PATCH] Use Cache-Control max-age instead of Expires headers Cache-Control max-age was introduced in HTTP/1.1 over ten years ago and is preferred to Expires. This replaces all expiry dates with an equivalent max-age in seconds. See: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching See: https://www.mnot.net/blog/2007/05/15/expires_max-age --- h5bp/location/expires.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/h5bp/location/expires.conf b/h5bp/location/expires.conf index 459dfd2..0033bd3 100644 --- a/h5bp/location/expires.conf +++ b/h5bp/location/expires.conf @@ -10,12 +10,12 @@ # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html?|xml|json)$ { - expires -1; + add_header Cache-Control "max-age=0"; } # Feed location ~* \.(?:rss|atom)$ { - expires 1h; + add_header Cache-Control "max-age=3600"; } # Media: images, icons, video, audio, HTC @@ -26,13 +26,13 @@ location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { # CSS and Javascript location ~* \.(?:css|js)$ { - expires 1y; + add_header Cache-Control "max-age=31536000"; access_log off; } # WebFonts # If you are NOT using cross-domain-fonts.conf, uncomment the following directive # location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { -# expires 1M; +# add_header Cache-Control "max-age=2592000"; # access_log off; # }