2019-02-10 20:46:58 +01:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# | Cache expiration |
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Serve resources with far-future expiration date.
|
|
|
|
#
|
|
|
|
# (!) If you don't control versioning with filename-based
|
|
|
|
# cache busting, you should consider lowering the cache times
|
|
|
|
# to something like one week.
|
|
|
|
#
|
|
|
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
|
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
|
|
|
|
# https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires
|
|
|
|
|
|
|
|
map $sent_http_content_type $expires {
|
2019-03-09 02:34:15 +01:00
|
|
|
default 1M;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# CSS
|
2019-03-09 02:34:15 +01:00
|
|
|
~*text/css 1y;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Data interchange
|
2019-03-09 02:34:15 +01:00
|
|
|
~*application/atom+xml 1h;
|
|
|
|
~*application/rdf+xml 1h;
|
|
|
|
~*application/rss+xml 1h;
|
|
|
|
|
|
|
|
~*application/json 0;
|
|
|
|
~*application/ld+json 0;
|
|
|
|
~*application/schema+json 0;
|
|
|
|
~*application/geo+json 0;
|
|
|
|
~*application/xml 0;
|
|
|
|
~*text/calendar 0;
|
|
|
|
~*text/xml 0;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Favicon (cannot be renamed!) and cursor images
|
2019-03-09 02:34:15 +01:00
|
|
|
~*image/vnd.microsoft.icon 1w;
|
|
|
|
~*image/x-icon 1w;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# HTML
|
2019-03-09 02:34:15 +01:00
|
|
|
~*text/html 0;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# JavaScript
|
2019-03-09 02:34:15 +01:00
|
|
|
~*application/javascript 1y;
|
|
|
|
~*application/x-javascript 1y;
|
|
|
|
~*text/javascript 1y;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Manifest files
|
2019-03-09 02:34:15 +01:00
|
|
|
~*application/manifest+json 1w;
|
|
|
|
~*application/x-web-app-manifest+json 0;
|
|
|
|
~*text/cache-manifest 0;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Markdown
|
2019-03-09 02:34:15 +01:00
|
|
|
~*text/markdown 0;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Media files
|
2019-03-09 02:41:29 +01:00
|
|
|
~*audio/ 1M;
|
|
|
|
~*image/ 1M;
|
|
|
|
~*video/ 1M;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# WebAssembly
|
2019-03-09 02:34:15 +01:00
|
|
|
~*application/wasm 1y;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Web fonts
|
2019-03-09 02:41:29 +01:00
|
|
|
~*font/ 1M;
|
2019-03-09 02:34:15 +01:00
|
|
|
~*application/vnd.ms-fontobject 1M;
|
|
|
|
~*application/x-font-ttf 1M;
|
|
|
|
~*application/x-font-woff 1M;
|
|
|
|
~*application/font-woff 1M;
|
|
|
|
~*application/font-woff2 1M;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
|
|
|
# Other
|
2019-03-09 02:34:15 +01:00
|
|
|
~*text/x-cross-domain-policy 1w;
|
2019-02-10 20:46:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
expires $expires;
|