@@ -448,19 +448,10 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
448
448
if !path. ends_with ( ".html" ) {
449
449
rendering_time. step ( "serve asset" ) ;
450
450
451
- let mut response = File ( blob) . serve ( ) ;
452
451
// default asset caching behaviour is `Cache::ForeverInCdnAndBrowser`.
453
- // We want invocation specific assets cached in the CDN but not in the browser.
454
- // That way we can invalidate the CDN cache after a build.
455
- // For CDN caching the same rules should apply as for HTML files,
456
- // which means we cache slightly different for `/latest/` and
457
- // URLs with versions.
458
- response. extensions . insert :: < CachePolicy > ( if is_latest_url {
459
- CachePolicy :: ForeverInCdn
460
- } else {
461
- CachePolicy :: ForeverInCdnAndStaleInBrowser
462
- } ) ;
463
- return Ok ( response) ;
452
+ // This is an edge-case when we serve invocation specific static assets under `/latest/`:
453
+ // https://github.com/rust-lang/docs.rs/issues/1593
454
+ return Ok ( File ( blob) . serve ( ) ) ;
464
455
}
465
456
466
457
rendering_time. step ( "find latest path" ) ;
@@ -850,7 +841,7 @@ mod test {
850
841
assert_success_cached (
851
842
"/buggy/0.1.0/directory_3/.gitignore" ,
852
843
web,
853
- CachePolicy :: ForeverInCdnAndStaleInBrowser ,
844
+ CachePolicy :: ForeverInCdnAndBrowser ,
854
845
& env. config ( ) ,
855
846
) ?;
856
847
assert_success_cached (
@@ -868,7 +859,7 @@ mod test {
868
859
assert_success_cached (
869
860
"/buggy/0.1.0/directory_4/empty_file_no_ext" ,
870
861
web,
871
- CachePolicy :: ForeverInCdnAndStaleInBrowser ,
862
+ CachePolicy :: ForeverInCdnAndBrowser ,
872
863
& env. config ( ) ,
873
864
) ?;
874
865
Ok ( ( ) )
0 commit comments