Skip to content

Commit c5ca36d

Browse files
committed
Actually tell browsers that cacheable assets are immutable
1 parent 288f66d commit c5ca36d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/web/cache.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ pub static SHORT: HeaderValue = HeaderValue::from_static("max-age=60");
1111
pub static NO_STORE_MUST_REVALIDATE: HeaderValue =
1212
HeaderValue::from_static("no-cache, no-store, must-revalidate, max-age=0");
1313

14-
pub static FOREVER_IN_CDN_AND_BROWSER: HeaderValue = HeaderValue::from_static("max-age=31104000");
14+
pub static FOREVER_IN_CDN_AND_BROWSER: HeaderValue =
15+
HeaderValue::from_static("public, max-age=31104000, immutable");
1516

1617
/// defines the wanted caching behaviour for a web response.
1718
#[derive(Debug, Clone)]
@@ -120,7 +121,10 @@ mod tests {
120121
CachePolicy::NoStoreMustRevalidate,
121122
Some("no-cache, no-store, must-revalidate, max-age=0")
122123
)]
123-
#[test_case(CachePolicy::ForeverInCdnAndBrowser, Some("max-age=31104000"))]
124+
#[test_case(
125+
CachePolicy::ForeverInCdnAndBrowser,
126+
Some("public, max-age=31104000, immutable")
127+
)]
124128
#[test_case(CachePolicy::ForeverInCdn, None)]
125129
#[test_case(
126130
CachePolicy::ForeverInCdnAndStaleInBrowser,

0 commit comments

Comments
 (0)