2019-02-10 20:46:58 +01:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# | Cache expiration |
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2020-04-14 11:53:56 +02:00
|
|
|
# Serve resources with a far-future expiration date.
|
2019-02-10 20:46:58 +01:00
|
|
|
#
|
2019-05-15 18:38:05 +02:00
|
|
|
# (!) If you don't control versioning with filename-based cache busting, you
|
2022-11-03 02:30:40 +01:00
|
|
|
# should consider lowering the cache times to something like one week.
|
2019-02-10 20:46:58 +01:00
|
|
|
#
|
|
|
|
# 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 {
|
2022-12-04 23:36:10 +01:00
|
|
|
# Default: Fallback
|
2021-11-14 22:18:27 +01:00
|
|
|
default 1y;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Default: No content
|
2019-05-15 02:30:40 +02:00
|
|
|
"" off;
|
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Specific: Assets
|
|
|
|
~*image/svg\+xml 1y;
|
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
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Specific: Manifests
|
2019-03-09 13:45:33 +01:00
|
|
|
~*application/manifest\+json 1w;
|
2022-10-28 10:44:28 +02:00
|
|
|
~*text/cache-manifest epoch;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Specific: Data interchange
|
|
|
|
~*application/atom\+xml 1h;
|
|
|
|
~*application/rdf\+xml 1h;
|
|
|
|
~*application/rss\+xml 1h;
|
|
|
|
|
|
|
|
# Specific: Documents
|
|
|
|
~*text/html epoch;
|
2022-10-28 10:44:28 +02:00
|
|
|
~*text/markdown epoch;
|
2022-12-04 23:36:10 +01:00
|
|
|
~*text/calendar epoch;
|
|
|
|
|
|
|
|
# Specific: Other
|
|
|
|
~*text/x-cross-domain-policy 1w;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Generic: Data
|
|
|
|
~*json epoch;
|
|
|
|
~*xml epoch;
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Generic: WebAssembly
|
|
|
|
# ~*application/wasm 1y; # default
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Generic: Assets
|
|
|
|
# ~*application/javascript 1y; # default
|
|
|
|
# ~*application/x-javascript 1y; # default
|
|
|
|
# ~*text/javascript 1y; # default
|
|
|
|
# ~*text/css 1y; # default
|
2019-02-10 20:46:58 +01:00
|
|
|
|
2022-12-04 23:36:10 +01:00
|
|
|
# Generic: Medias
|
|
|
|
# ~*audio/ 1y; # default
|
|
|
|
# ~*image/ 1y; # default
|
|
|
|
# ~*video/ 1y; # default
|
|
|
|
# ~*font/ 1y; # default
|
2019-02-10 20:46:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
expires $expires;
|