Skip to content

Commit 7d6147d

Browse files
committed
migrate opensearch.xml redirect to axum
1 parent 6337d2b commit 7d6147d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/web/routes.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ pub(super) fn build_axum_routes() -> AxumRouter {
5353
"/-/static/*path",
5454
get_static(super::statics::static_handler),
5555
)
56+
.route(
57+
"/opensearch.xml",
58+
get_static(|| async { Redirect::permanent("/-/static/opensearch.xml") }),
59+
)
5660
.route(
5761
"/sitemap.xml",
5862
get_internal(super::sitemap::sitemapindex_handler),
@@ -120,13 +124,6 @@ pub(super) fn build_axum_routes() -> AxumRouter {
120124
pub(super) fn build_routes() -> Routes {
121125
let mut routes = Routes::new();
122126

123-
// This should not need to be served from the root as we reference the inner path in links,
124-
// but clients might have cached the url and need to update it.
125-
routes.static_resource(
126-
"/opensearch.xml",
127-
PermanentRedirect("/-/static/opensearch.xml"),
128-
);
129-
130127
routes.internal_page(
131128
"/-/rustdoc.static/:single",
132129
super::rustdoc::static_asset_handler,

0 commit comments

Comments
 (0)