Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Jan 2, 2025
1 parent dd812ae commit a9029d0
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/web/statics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::{cache::CachePolicy, metrics::request_recorder, routes::get_static};
use axum::{
extract::{Extension, Request},
http::header::CONTENT_TYPE,
http::{StatusCode, Uri},
middleware,
middleware::Next,
response::{IntoResponse, Response},
Expand Down Expand Up @@ -68,18 +67,13 @@ pub(crate) fn build_static_router() -> AxumRouter {
"/rustdoc-2021-12-05.css",
get_static(|| async { build_static_css_response(RUSTDOC_2021_12_05_CSS) }),
)
.fallback(fallback)
// .fallback_service(
// get_service(ServeDir::new("static").fallback(ServeDir::new("vendor")))
// .layer(middleware::from_fn(set_needed_static_headers))
// .layer(middleware::from_fn(|request, next| async {
// request_recorder(request, next, Some("static resource")).await
// })),
// )
}
async fn fallback(uri: Uri) -> (StatusCode, String) {
dbg!(&uri);
(StatusCode::NOT_FOUND, format!("No route for {uri}"))
.fallback_service(
get_service(ServeDir::new("static").fallback(ServeDir::new("vendor")))
.layer(middleware::from_fn(set_needed_static_headers))
.layer(middleware::from_fn(|request, next| async {
request_recorder(request, next, Some("static resource")).await
})),
)
}

#[cfg(test)]
Expand Down

0 comments on commit a9029d0

Please sign in to comment.