@@ -51,18 +51,15 @@ impl CachePolicy {
5151 ]
5252 }
5353 CachePolicy :: ForeverInCdnAndBrowser => {
54- vec ! [
55- CacheDirective :: Public ,
56- CacheDirective :: MaxAge ( STATIC_FILE_CACHE_DURATION as u32 ) ,
57- ]
54+ vec ! [ CacheDirective :: MaxAge ( STATIC_FILE_CACHE_DURATION as u32 ) ]
5855 }
5956 CachePolicy :: ForeverInCdn => {
6057 // A missing `max-age` or `s-maxage` in the Cache-Control header will lead to
6158 // CloudFront using the default TTL, while the browser not seeing any caching header.
6259 // This means we can have the CDN caching the documentation while just
6360 // issuing a purge after a build.
6461 // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html#ExpirationDownloadDist
65- vec ! [ CacheDirective :: Public ]
62+ vec ! [ ]
6663 }
6764 CachePolicy :: ForeverInCdnAndStaleInBrowser => {
6865 let mut directives = CachePolicy :: ForeverInCdn . render ( config) ;
@@ -124,11 +121,11 @@ mod tests {
124121 CachePolicy :: NoStoreMustRevalidate ,
125122 "no-cache, no-store, must-revalidate, max-age=0"
126123 ) ]
127- #[ test_case( CachePolicy :: ForeverInCdnAndBrowser , "public, max-age=31104000" ) ]
128- #[ test_case( CachePolicy :: ForeverInCdn , "public " ) ]
124+ #[ test_case( CachePolicy :: ForeverInCdnAndBrowser , "max-age=31104000" ) ]
125+ #[ test_case( CachePolicy :: ForeverInCdn , "" ) ]
129126 #[ test_case(
130127 CachePolicy :: ForeverInCdnAndStaleInBrowser ,
131- "public, stale-while-revalidate=86400"
128+ "stale-while-revalidate=86400"
132129 ) ]
133130 fn render ( cache : CachePolicy , expected : & str ) {
134131 wrapper ( |env| {
@@ -148,7 +145,7 @@ mod tests {
148145 assert_eq ! (
149146 CacheControl ( CachePolicy :: ForeverInCdnAndStaleInBrowser . render( & env. config( ) ) )
150147 . to_string( ) ,
151- "public "
148+ ""
152149 ) ;
153150 Ok ( ( ) )
154151 } ) ;
@@ -163,7 +160,7 @@ mod tests {
163160 assert_eq ! (
164161 CacheControl ( CachePolicy :: ForeverInCdnAndStaleInBrowser . render( & env. config( ) ) )
165162 . to_string( ) ,
166- "public, stale-while-revalidate=666"
163+ "stale-while-revalidate=666"
167164 ) ;
168165 Ok ( ( ) )
169166 } ) ;
0 commit comments