From 60c636738be96484aabd7e9abc2ee0310211be3f Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 12 Jan 2021 16:46:53 +0100 Subject: [PATCH] fix cors error --- meilisearch-http/src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index 800e2760c..08b00e018 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -82,13 +82,15 @@ async fn main() -> Result<(), MainError> { let enable_frontend = opt.env != "production"; let http_server = HttpServer::new(move || { - create_app(&data, enable_frontend) - .wrap( - Cors::default() + let cors = Cors::default() .send_wildcard() .allowed_headers(vec!["content-type", "x-meili-api-key"]) - .max_age(86_400) // 24h - ) + .allow_any_origin() + .allow_any_method() + .max_age(86_400); // 24h + + create_app(&data, enable_frontend) + .wrap(cors) .wrap(middleware::Logger::default()) .wrap(middleware::Compress::default()) .wrap(NormalizePath)