From b2add23997dd5ef2995a69b55f604db0077d6ca7 Mon Sep 17 00:00:00 2001 From: Jose Quintana <1700322+joseluisq@users.noreply.github.com> Date: Wed, 9 Mar 2022 16:36:59 +0100 Subject: [PATCH] Merge pull request #88 from csmith/cache-avif-jxl feat: add AVIF and JPEG XL to one year cache-control list --- docs/content/features/cache-control-headers.md | 2 +- src/control_headers.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content/features/cache-control-headers.md b/docs/content/features/cache-control-headers.md index 28f5be5..c063963 100644 --- a/docs/content/features/cache-control-headers.md +++ b/docs/content/features/cache-control-headers.md @@ -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. diff --git a/src/control_headers.rs b/src/control_headers.rs index 558a6bf..aecc904 100644 --- a/src/control_headers.rs +++ b/src/control_headers.rs @@ -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", ]; /// It appends a `Cache-Control` header to a response if that one is part of a set of file types. -- libgit2 1.7.2