From c3cf0cade907dd138ad03e80cce3571ec448ab9a Mon Sep 17 00:00:00 2001 From: Quentin de Quelen Date: Thu, 9 Apr 2020 14:19:06 +0200 Subject: [PATCH 1/2] fix tide cors --- meilisearch-http/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index 124bb9c47..0703e65c9 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -4,7 +4,8 @@ use async_std::task; use log::info; use main_error::MainError; use structopt::StructOpt; -use tide::middleware::{Cors, RequestLogger}; +use tide::middleware::{Cors, RequestLogger, Origin}; +use http::header::HeaderValue; use meilisearch_http::data::Data; use meilisearch_http::option::Opt; @@ -51,7 +52,10 @@ pub fn main() -> Result<(), MainError> { let mut app = tide::with_state(data); - app.middleware(Cors::new()); + app.middleware(Cors::new() + .allow_methods(HeaderValue::from_static("GET, POST, PUT, DELETE, OPTIONS")) + .allow_headers(HeaderValue::from_static("X-Meili-API-Key")) + .allow_origin(Origin::from("*"))); app.middleware(RequestLogger::new()); routes::load_routes(&mut app); From 2fdf33a006d5525f0e8f949dc0df79fc7ae62d18 Mon Sep 17 00:00:00 2001 From: Quentin de Quelen Date: Thu, 9 Apr 2020 14:24:19 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3106f9c3..4e9c82f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,4 @@ - Publish an ARMv7 and ARMv8 binaries on releases (#540 and #581) - Fixed a bug where the result of the update status after the first update was empty (#542) - Fixed a bug where stop words were not handled correctly (#594) + - Fix CORS issues (#602)