fix: correct layer ordering

This commit is contained in:
dusk 2023-05-05 13:41:04 +03:00
parent e129bf6651
commit 5f4d694d07
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -115,15 +115,15 @@ pub(super) async fn handler(state: AppState) -> Result<(Router, Router), AppErro
.route("/audio/external_id/:id", get(get_music)) .route("/audio/external_id/:id", get(get_music))
.route("/audio/scoped/:id", get(get_scoped_music)) .route("/audio/scoped/:id", get(get_scoped_music))
.route("/", get(metadata_ws)) .route("/", get(metadata_ws))
.layer(SetRequestIdLayer::new(REQUEST_ID.clone(), MakeRequestUuid))
.layer(SetSensitiveRequestHeadersLayer::new([AUTHORIZATION]))
.layer(trace_layer) .layer(trace_layer)
.layer(SetSensitiveRequestHeadersLayer::new([AUTHORIZATION]))
.layer( .layer(
CorsLayer::new() CorsLayer::new()
.allow_origin(tower_http::cors::Any) .allow_origin(tower_http::cors::Any)
.allow_headers([CONTENT_TYPE, CACHE_CONTROL, REQUEST_ID]) .allow_headers([CONTENT_TYPE, CACHE_CONTROL, REQUEST_ID])
.allow_methods([Method::GET]), .allow_methods([Method::GET]),
) )
.layer(SetRequestIdLayer::new(REQUEST_ID.clone(), MakeRequestUuid))
.with_state(state); .with_state(state);
Ok((router, internal_router)) Ok((router, internal_router))