From 772e36d20461038e1c003397abd3ae8e69c8e8c6 Mon Sep 17 00:00:00 2001 From: "Matthew D. Groves" Date: Tue, 26 Sep 2023 10:39:10 -0400 Subject: [PATCH] #25 turned on very permissive CORS --- Conduit/Conduit.Web/Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Conduit/Conduit.Web/Program.cs b/Conduit/Conduit.Web/Program.cs index 4db3fc35d1..5435038ffb 100644 --- a/Conduit/Conduit.Web/Program.cs +++ b/Conduit/Conduit.Web/Program.cs @@ -35,6 +35,17 @@ public static void Main(string[] args) builder.Services.AddConduitServiceDependencies(builder.Configuration); + builder.Services.AddCors(options => + { + options.AddPolicy(name: "CorsPolicy", + builder => + { + builder.AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod(); + }); + }); + // **************************************************** var app = builder.Build(); @@ -54,6 +65,8 @@ public static void Main(string[] args) app.MapControllers(); + app.UseCors("CorsPolicy"); + app.Run(); // Add the following line to close the Couchbase connection inside the app.Run() method at the end of Program.cs