Skip to content

Commit

Permalink
custom cors layer
Browse files Browse the repository at this point in the history
  • Loading branch information
JieningYu committed Mar 28, 2024
1 parent 2801c0c commit 88f2fe7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use dmds_tokio_fs::FsHandle;
use paper::Paper;
use question::Question;
use serde::Deserialize;
use tower_http::cors::CorsLayer;
use tower_http::cors::{self, CorsLayer};

mod paper;
mod question;
Expand Down Expand Up @@ -106,7 +106,12 @@ async fn main() {
&format!("/{}/{}", config.mng_secret, config.mng_reject_papers_secret),
post(paper::reject::<FsHandle>),
)
.layer(CorsLayer::very_permissive())
.layer(
CorsLayer::new()
.allow_methods(cors::Any)
.allow_origin(cors::Any)
.allow_headers(cors::Any),
)
.with_state(state.clone());

tokio::spawn(dmds_tokio_fs::daemon(
Expand Down

0 comments on commit 88f2fe7

Please sign in to comment.