Replace location block `add_header` directives with `expires` directives

Fixes https://github.com/h5bp/server-configs-nginx/issues/193
This commit is contained in:
Matt Rubin 2018-03-06 14:53:04 -05:00 committed by Léo Colombaro
parent c5c6602232
commit 135d093a75
2 changed files with 7 additions and 7 deletions

View File

@ -8,5 +8,5 @@ location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
# And https://github.com/h5bp/server-configs/issues/85
# And https://github.com/h5bp/server-configs/issues/86
access_log off;
add_header Cache-Control "max-age=2592000";
expires 1M;
}

View File

@ -10,36 +10,36 @@
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
add_header Cache-Control "max-age=0";
expires 0;
}
# Feed
location ~* \.(?:rss|atom)$ {
add_header Cache-Control "max-age=3600";
expires 1h;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
access_log off;
add_header Cache-Control "max-age=2592000";
expires 1M;
}
# Media: svgz files are already compressed.
location ~* \.svgz$ {
access_log off;
gzip off;
add_header Cache-Control "max-age=2592000";
expires 1M;
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
add_header Cache-Control "max-age=31536000";
expires 1y;
access_log off;
}
# WebFonts
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
# location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
# add_header Cache-Control "max-age=2592000";
# expires 1M;
# access_log off;
# }