We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4dc493 commit 6c24e02Copy full SHA for 6c24e02
src/web/rustdoc.rs
@@ -542,12 +542,16 @@ pub(crate) async fn rustdoc_html_server_handler(
542
} else if req_path.first().map_or(false, |p| p.contains('-')) {
543
// This is a target, not a module; it may not have been built.
544
// Redirect to the default target and show a search page instead of a hard 404.
545
- redirect(
546
- &format!("/crate/{}", params.name),
547
- &format!("{}/target-redirect", version),
548
- &req_path,
+ Ok(axum_cached_redirect(
+ format!(
+ "/crate/{}/{}/target-redirect/{}",
+ params.name,
549
+ version,
550
+ req_path.join("/")
551
+ ),
552
CachePolicy::ForeverInCdn,
- )
553
+ )?
554
+ .into_response())
555
} else {
556
Err(AxumNope::ResourceNotFound)
557
};
0 commit comments