mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
fix cors error
This commit is contained in:
parent
fa40c6e3d4
commit
60c636738b
@ -82,13 +82,15 @@ async fn main() -> Result<(), MainError> {
|
|||||||
|
|
||||||
let enable_frontend = opt.env != "production";
|
let enable_frontend = opt.env != "production";
|
||||||
let http_server = HttpServer::new(move || {
|
let http_server = HttpServer::new(move || {
|
||||||
create_app(&data, enable_frontend)
|
let cors = Cors::default()
|
||||||
.wrap(
|
|
||||||
Cors::default()
|
|
||||||
.send_wildcard()
|
.send_wildcard()
|
||||||
.allowed_headers(vec!["content-type", "x-meili-api-key"])
|
.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::Logger::default())
|
||||||
.wrap(middleware::Compress::default())
|
.wrap(middleware::Compress::default())
|
||||||
.wrap(NormalizePath)
|
.wrap(NormalizePath)
|
||||||
|
Loading…
Reference in New Issue
Block a user