Merge pull request #88 from csmith/cache-avif-jxl
feat: add AVIF and JPEG XL to one year cache-control list
Diff
docs/content/features/cache-control-headers.md | 2 +-
src/control_headers.rs | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
@@ -28,7 +28,7 @@ atom, json, rss, xml
A `max-age` of *one year* is applied only to the following file types.
```txt
bmp, bz2, css, doc, gif, gz, htc, ico, jpeg, jpg, js, map, mjs, mp3, mp4, ogg, ogv, pdf, png, rar, rtf, tar, tgz, wav, weba, webm, webp, woff, woff2, zip
avif, bmp, bz2, css, doc, gif, gz, htc, ico, jpeg, jpg, js, jxl, map, mjs, mp3, mp4, ogg, ogv, pdf, png, rar, rtf, tar, tgz, wav, weba, webm, webp, woff, woff2, zip
```
Below an example of how to enable the feature.
@@ -6,10 +6,10 @@ use headers::{CacheControl, HeaderMapExt};
use hyper::{Body, Response};
const CACHE_EXT_ONE_HOUR: [&str; 4] = ["atom", "json", "rss", "xml"];
const CACHE_EXT_ONE_YEAR: [&str; 30] = [
"bmp", "bz2", "css", "doc", "gif", "gz", "htc", "ico", "jpeg", "jpg", "js", "map", "mjs",
"mp3", "mp4", "ogg", "ogv", "pdf", "png", "rar", "rtf", "tar", "tgz", "wav", "weba", "webm",
"webp", "woff", "woff2", "zip",
const CACHE_EXT_ONE_YEAR: [&str; 32] = [
"avif", "bmp", "bz2", "css", "doc", "gif", "gz", "htc", "ico", "jpeg", "jpg", "js", "jxl",
"map", "mjs", "mp3", "mp4", "ogg", "ogv", "pdf", "png", "rar", "rtf", "tar", "tgz", "wav",
"weba", "webm", "webp", "woff", "woff2", "zip",
];