From 28a53a8eebb8c5cc77b76418c8e7687f2ea8d8b2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 21 Aug 2023 02:23:31 +0200 Subject: [PATCH] allow auth & content-type in header for cors --- backend/windmill-api/src/jobs.rs | 1 + backend/windmill-api/src/lib.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index cc990efca9..8564b2e48f 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -46,6 +46,7 @@ use windmill_queue::{get_queued_job, push, QueueTransaction}; pub fn workspaced_service() -> Router { let cors = CorsLayer::new() .allow_methods([http::Method::GET, http::Method::POST]) + .allow_headers([http::header::CONTENT_TYPE, http::header::AUTHORIZATION]) .allow_origin(Any); Router::new() diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index 22997bf202..34a76ccda1 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -24,7 +24,7 @@ use axum::extract::DefaultBodyLimit; use axum::{middleware::from_extractor, routing::get, Extension, Router}; use db::DB; use git_version::git_version; -use hyper::Method; +use hyper::{http, Method}; use mail_send::SmtpClientBuilder; use reqwest::Client; use std::{net::SocketAddr, sync::Arc}; @@ -185,6 +185,7 @@ pub async fn run_server( let cors = CorsLayer::new() .allow_methods([Method::GET, Method::POST]) + .allow_headers([http::header::CONTENT_TYPE, http::header::AUTHORIZATION]) .allow_origin(Any); #[cfg(feature = "enterprise")]