Fix Cache-Control headers overriding security headers

This commit is contained in:
Ashley Rich 2018-12-14 16:25:41 +00:00
parent 3f52323dca
commit 78a7eef119

View File

@ -1,35 +1,35 @@
# Don't cache appcache, document html and data. # Don't cache appcache, document html and data.
location ~* \.(?:manifest|appcache|html?|xml|json)$ { location ~* \.(?:manifest|appcache|html?|xml|json)$ {
add_header Cache-Control "max-age=0"; expires 0;
} }
# Cache RSS and Atom feeds. # Cache RSS and Atom feeds.
location ~* \.(?:rss|atom)$ { location ~* \.(?:rss|atom)$ {
add_header Cache-Control "max-age=3600"; expires 1h;
} }
# Caches images, icons, video, audio, HTC, etc. # Caches images, icons, video, audio, HTC, etc.
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ { location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
add_header Cache-Control "max-age=31536000"; expires 1y;
access_log off; access_log off;
} }
# Cache svgz files, but don't compress them. # Cache svgz files, but don't compress them.
location ~* \.svgz$ { location ~* \.svgz$ {
add_header Cache-Control "max-age=31536000"; expires 1y;
access_log off; access_log off;
gzip off; gzip off;
} }
# Cache CSS and JavaScript. # Cache CSS and JavaScript.
location ~* \.(?:css|js)$ { location ~* \.(?:css|js)$ {
add_header Cache-Control "max-age=31536000"; expires 1y;
access_log off; access_log off;
} }
# Cache WebFonts. # Cache WebFonts.
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
add_header Cache-Control "max-age=31536000"; expires 1y;
access_log off; access_log off;
} }