Add other methods to cors layer

This commit is contained in:
clowzed 2023-11-08 22:52:58 +03:00
parent b0d6cbda17
commit 38dd87bd6e

View file

@ -68,7 +68,7 @@ async fn main() {
.route("/", get(handlers::sites::index_redirect))
.layer(
CorsLayer::new()
.allow_methods(AllowMethods::exact(Method::GET))
.allow_methods(AllowMethods::list([Method::GET, Method::POST, Method::OPTIONS]))
.allow_headers(AllowHeaders::list([HeaderName::from_static("x-subdomain")]))
.allow_origin(AllowOrigin::predicate(move |origin, parts| {
let cloned_state = cloned_state.clone();