1
Fork 0
mirror of https://github.com/Steffo99/distributed-arcade.git synced 2024-11-21 23:54:25 +00:00

Fix CORS headers

This commit is contained in:
Steffo 2023-02-28 20:47:54 +01:00
parent c723701425
commit 10de3bd848
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -29,7 +29,16 @@ async fn main() {
.route("/score/", put(routes::score::route_score_put)) .route("/score/", put(routes::score::route_score_put))
.layer(axum::Extension(rclient)) .layer(axum::Extension(rclient))
.layer(tower_http::cors::CorsLayer::new() .layer(tower_http::cors::CorsLayer::new()
.allow_origin("*".parse::<axum::http::HeaderValue>().expect("* to be a valid origin")) .allow_origin(
tower_http::cors::Any
)
.allow_headers([
axum::http::header::AUTHORIZATION,
axum::http::header::CONTENT_TYPE,
])
.allow_methods(
tower_http::cors::Any
)
); );
log::info!("Starting Axum server..."); log::info!("Starting Axum server...");