Remove references to Cache-Control public

A previous commit removed some, but missed these. Where a location
directive was using Expires to set a future expiry in conjunction
with Cache-Control public, I have replaced the time with an equal
max-age.

Furthermore, Google's web performance guide says that "public" is
implicit if there is a max-age specified.

See: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
This commit is contained in:
Alan Orth 2016-11-15 15:37:26 +02:00
parent cb3dc0554e
commit b0c1406cf9
No known key found for this signature in database
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 2 additions and 6 deletions

View File

@ -148,7 +148,6 @@ will be a 404. The reason for this is that H5bp's basic ruleset includes, for ex
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M; expires 1M;
access_log off; access_log off;
add_header Cache-Control "public";
} }
Which will _also_ capture any dynamic requests matching that url pattern and not Which will _also_ capture any dynamic requests matching that url pattern and not
@ -166,7 +165,6 @@ Modifying (all) location blocks as follows:
expires 1M; expires 1M;
access_log off; access_log off;
add_header Cache-Control "public";
} }
Will make Nginx pass requests for files that don't exist to the application. Will make Nginx pass requests for files that don't exist to the application.

View File

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

View File

@ -20,9 +20,8 @@ location ~* \.(?:rss|atom)$ {
# Media: images, icons, video, audio, HTC # Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off; access_log off;
add_header Cache-Control "public"; add_header Cache-Control "max-age=2592000";
} }
# CSS and Javascript # CSS and Javascript