@@ -448,19 +448,10 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
448448 if !path. ends_with ( ".html" ) {
449449 rendering_time. step ( "serve asset" ) ;
450450
451- let mut response = File ( blob) . serve ( ) ;
452451 // 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 ( ) ) ;
464455 }
465456
466457 rendering_time. step ( "find latest path" ) ;
@@ -850,7 +841,7 @@ mod test {
850841 assert_success_cached (
851842 "/buggy/0.1.0/directory_3/.gitignore" ,
852843 web,
853- CachePolicy :: ForeverInCdnAndStaleInBrowser ,
844+ CachePolicy :: ForeverInCdnAndBrowser ,
854845 & env. config ( ) ,
855846 ) ?;
856847 assert_success_cached (
@@ -868,7 +859,7 @@ mod test {
868859 assert_success_cached (
869860 "/buggy/0.1.0/directory_4/empty_file_no_ext" ,
870861 web,
871- CachePolicy :: ForeverInCdnAndStaleInBrowser ,
862+ CachePolicy :: ForeverInCdnAndBrowser ,
872863 & env. config ( ) ,
873864 ) ?;
874865 Ok ( ( ) )
0 commit comments