diff --git a/src/bin/dolos/init/mod.rs b/src/bin/dolos/init/mod.rs index 6ca1c3c..81ba903 100644 --- a/src/bin/dolos/init/mod.rs +++ b/src/bin/dolos/init/mod.rs @@ -196,7 +196,7 @@ impl ConfigEditor { self.0.serve.grpc = dolos::serve::grpc::Config { listen_address: "[::]:50051".into(), tls_client_ca_root: None, - cors_enabled: true, + permissive_cors: Some(true), } .into(); } else { diff --git a/src/serve/grpc/mod.rs b/src/serve/grpc/mod.rs index fc52d23..6d2f4c4 100644 --- a/src/serve/grpc/mod.rs +++ b/src/serve/grpc/mod.rs @@ -23,7 +23,7 @@ mod watch; pub struct Config { pub listen_address: String, pub tls_client_ca_root: Option, - pub cors_enabled: bool, + pub permissive_cors: Option, } pub async fn serve( @@ -59,11 +59,12 @@ pub async fn serve( .build_v1() .unwrap(); - let cors_layer = if config.cors_enabled { + let cors_layer = if config.permissive_cors.unwrap_or_default() { CorsLayer::permissive() } else { CorsLayer::new() }; + let mut server = Server::builder().accept_http1(true).layer(cors_layer); if let Some(pem) = config.tls_client_ca_root {