Add any for check if cors layer actually works

This commit is contained in:
clowzed 2023-11-08 23:33:10 +03:00
parent 38dd87bd6e
commit c819a69741

View file

@ -68,6 +68,10 @@ async fn main() {
.route("/", get(handlers::sites::index_redirect)) .route("/", get(handlers::sites::index_redirect))
.layer( .layer(
CorsLayer::new() CorsLayer::new()
.allow_methods(AllowMethods::any())
.allow_headers(AllowHeaders::any())
.allow_origin(AllowOrigin::any())
/* CorsLayer::new()
.allow_methods(AllowMethods::list([Method::GET, Method::POST, Method::OPTIONS])) .allow_methods(AllowMethods::list([Method::GET, Method::POST, Method::OPTIONS]))
.allow_headers(AllowHeaders::list([HeaderName::from_static("x-subdomain")])) .allow_headers(AllowHeaders::list([HeaderName::from_static("x-subdomain")]))
.allow_origin(AllowOrigin::predicate(move |origin, parts| { .allow_origin(AllowOrigin::predicate(move |origin, parts| {
@ -105,7 +109,7 @@ async fn main() {
}); });
rx.recv().unwrap_or(false) rx.recv().unwrap_or(false)
})), })), */
) )
.with_state(state.clone()); .with_state(state.clone());