From 70aa790c1677fbbf4b4e9d4033f1a65fa1ec6725 Mon Sep 17 00:00:00 2001 From: Stedoss <29103029+Stedoss@users.noreply.github.com> Date: Tue, 1 Nov 2022 20:20:49 +0000 Subject: [PATCH] Allow CORS for any origin whilst in development --- backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs index 79e14dd..bf2d6a9 100644 --- a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs @@ -14,6 +14,8 @@ builder.Services.AddSwaggerGen(); // App services builder.Services.AddServiceDependencies(); +builder.Services.AddCors(); + var app = builder.Build(); @@ -28,6 +30,9 @@ if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); + + app.UseCors(options => + options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); } app.UseHttpsRedirection();