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
This commit is contained in:
Alan Orth 2016-11-15 15:46:34 +02:00
parent b0c1406cf9
commit fd84b1f429
No known key found for this signature in database
GPG Key ID: 0FB860CC9C45B1B9
1 changed files with 4 additions and 4 deletions

View File

@ -10,12 +10,12 @@
# cache.appcache, your document html and data # cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ { location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1; add_header Cache-Control "max-age=0";
} }
# Feed # Feed
location ~* \.(?:rss|atom)$ { location ~* \.(?:rss|atom)$ {
expires 1h; add_header Cache-Control "max-age=3600";
} }
# Media: images, icons, video, audio, HTC # 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 # CSS and Javascript
location ~* \.(?:css|js)$ { location ~* \.(?:css|js)$ {
expires 1y; add_header Cache-Control "max-age=31536000";
access_log off; access_log off;
} }
# WebFonts # WebFonts
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive # If you are NOT using cross-domain-fonts.conf, uncomment the following directive
# location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { # location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
# expires 1M; # add_header Cache-Control "max-age=2592000";
# access_log off; # access_log off;
# } # }