Merge pull request #168 from alanorth/cache-control-public
Use Cache-Control instead of Expires
This commit is contained in:
commit
1cc4b14e51
|
@ -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.
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,30 +10,29 @@
|
||||||
|
|
||||||
# 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
|
||||||
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
|
||||||
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;
|
||||||
# }
|
# }
|
||||||
|
|
Loading…
Reference in New Issue