Skip to content

Commit 314ec9a

Browse files
committed
🐛 Update CORS policy
1 parent 5be688e commit 314ec9a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/middleware/cors.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/// Router layers for Cross-Origin Resource Sharing (CORS).
66
pub mod layers {
77
use api_framework::static_lazy_lock;
8-
use axum::http::{HeaderValue, request};
9-
use tower_http::cors::{AllowOrigin, CorsLayer};
8+
use axum::http::{HeaderValue, header, request};
9+
use tower_http::cors::{AllowOrigin, Any, CorsLayer};
1010

1111
use crate::config::{CorsRuntimeConfig, RuntimeConfig};
1212

@@ -16,6 +16,8 @@ pub mod layers {
1616
let config = CorsRuntimeConfig::load_or_default().await;
1717
config.contains(&origin)
1818
}))
19-
.allow_credentials(true);
19+
.allow_credentials(true)
20+
.allow_methods(Any)
21+
.allow_headers([header::AUTHORIZATION, header::CONTENT_TYPE, header::COOKIE]);
2022
}
2123
}

0 commit comments

Comments
 (0)