@@ -51,18 +51,15 @@ impl CachePolicy {
51
51
]
52
52
}
53
53
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 ) ]
58
55
}
59
56
CachePolicy :: ForeverInCdn => {
60
57
// A missing `max-age` or `s-maxage` in the Cache-Control header will lead to
61
58
// CloudFront using the default TTL, while the browser not seeing any caching header.
62
59
// This means we can have the CDN caching the documentation while just
63
60
// issuing a purge after a build.
64
61
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html#ExpirationDownloadDist
65
- vec ! [ CacheDirective :: Public ]
62
+ vec ! [ ]
66
63
}
67
64
CachePolicy :: ForeverInCdnAndStaleInBrowser => {
68
65
let mut directives = CachePolicy :: ForeverInCdn . render ( config) ;
@@ -124,11 +121,11 @@ mod tests {
124
121
CachePolicy :: NoStoreMustRevalidate ,
125
122
"no-cache, no-store, must-revalidate, max-age=0"
126
123
) ]
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 , "" ) ]
129
126
#[ test_case(
130
127
CachePolicy :: ForeverInCdnAndStaleInBrowser ,
131
- "public, stale-while-revalidate=86400"
128
+ "stale-while-revalidate=86400"
132
129
) ]
133
130
fn render ( cache : CachePolicy , expected : & str ) {
134
131
wrapper ( |env| {
@@ -148,7 +145,7 @@ mod tests {
148
145
assert_eq ! (
149
146
CacheControl ( CachePolicy :: ForeverInCdnAndStaleInBrowser . render( & env. config( ) ) )
150
147
. to_string( ) ,
151
- "public "
148
+ ""
152
149
) ;
153
150
Ok ( ( ) )
154
151
} ) ;
@@ -163,7 +160,7 @@ mod tests {
163
160
assert_eq ! (
164
161
CacheControl ( CachePolicy :: ForeverInCdnAndStaleInBrowser . render( & env. config( ) ) )
165
162
. to_string( ) ,
166
- "public, stale-while-revalidate=666"
163
+ "stale-while-revalidate=666"
167
164
) ;
168
165
Ok ( ( ) )
169
166
} ) ;
0 commit comments