From e1cd832299c805f0f3f6fc3f195b04f82dabf78e Mon Sep 17 00:00:00 2001 From: pfg Date: Fri, 23 Jun 2023 12:09:26 -0500 Subject: [PATCH] Allow cross-origin requests Co-authored-by: diamondburned --- crates/utils/translations | 2 +- src/lib.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/utils/translations b/crates/utils/translations index 5a9d44656e..7fc71d0860 160000 --- a/crates/utils/translations +++ b/crates/utils/translations @@ -1 +1 @@ -Subproject commit 5a9d44656e2658ab7cb2dbec3fd1bfaf57654533 +Subproject commit 7fc71d0860bbe5c6d620ec27112350ffe5b9229c diff --git a/src/lib.rs b/src/lib.rs index cc77ca48f4..d2fd29d06e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,14 +136,12 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> { // Create Http server with websocket support HttpServer::new(move || { - let cors_config = if cfg!(debug_assertions) { - Cors::permissive() - } else { - let cors_origin = std::env::var("LEMMY_CORS_ORIGIN").unwrap_or("http://localhost".into()); - Cors::default() - .allowed_origin(&cors_origin) - .allowed_origin(&settings.get_protocol_and_hostname()) - }; + let cors_config = Cors::default() + .allow_any_origin() + .allow_any_method() + .allow_any_header() + .expose_any_header() + .max_age(3600); App::new() .wrap(middleware::Logger::new(