From f00c7dd99c4c55580fcd4031bb4742fdbe8e8f52 Mon Sep 17 00:00:00 2001 From: Santhosh S <913341@dadeschools.net> Date: Sun, 12 Nov 2023 14:28:58 -0500 Subject: [PATCH] Updated WithOrigins(http://localhost:3000) test fix CORS --- .../DamageAssesment.Api.Surveys/Program.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs index 93545ae..eca1be6 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs @@ -40,16 +40,20 @@ builder.Services.AddAuthentication(item => -builder.Services.AddCors(options => -{ - options.AddPolicy("DamageAppCorsPolicy", builder => - { - builder.WithOrigins("*") - .AllowAnyHeader() - .WithMethods("POST") // Allowing only the POST method - .AllowAnyOrigin(); - }); -}); +//builder.Services.AddCors(options => +//{ +// options.AddPolicy("DamageAppCorsPolicy", builder => +// { +// builder.WithOrigins("*") +// .AllowAnyHeader() +// .WithMethods("POST") // Allowing only the POST method +// .AllowAnyOrigin(); +// }); + +//}); +builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => { + build.WithOrigins("http://localhost:3000").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin(); +})); // Add controller services and API Explorer for endpoint discovery. builder.Services.AddControllers();