From 4fd931c5085d581eac72a1bbcfeb07a577f30a81 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Thu, 20 Jul 2023 21:02:14 +0000 Subject: [PATCH] add cors layer --- bin/core/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/core/src/main.rs b/bin/core/src/main.rs index 0c0de06fd..2dbc75e97 100644 --- a/bin/core/src/main.rs +++ b/bin/core/src/main.rs @@ -3,6 +3,7 @@ extern crate log; use axum::{Extension, Router}; use termination_signal::tokio::immediate_term_handle; +use tower_http::cors::{Any, CorsLayer}; mod auth; mod cloud; @@ -28,7 +29,13 @@ async fn app() -> anyhow::Result<()> { .nest("/execute", requests::execute::router()) .nest("/listener", listener::router()) .nest("/ws", ws::router()) - .layer(Extension(state)); + .layer(Extension(state)) + .layer( + CorsLayer::new() + .allow_origin(Any) + .allow_methods(Any) + .allow_headers(Any), + ); info!("starting monitor core on {socket_addr}");