fix: hmmm cors layer must be first?

This commit is contained in:
əlemi 2024-06-06 20:51:45 +02:00
parent 15e9118ed2
commit 6b24db86f2
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -31,6 +31,7 @@ pub async fn serve(ctx: upub::Context, bind: String) -> Result<(), std::io::Erro
use tower_http::{cors::CorsLayer, trace::TraceLayer};
let router = axum::Router::new()
.layer(CorsLayer::permissive())
.layer(
// TODO 4xx errors aren't really failures but since upub is in development it's useful to log
// these too, in case something's broken
@ -44,7 +45,6 @@ pub async fn serve(ctx: upub::Context, bind: String) -> Result<(), std::io::Erro
)
})
)
.layer(CorsLayer::permissive())
.ap_routes()
.mastodon_routes() // no-op if mastodon feature is disabled
.with_state(ctx);