Updated WithOrigins(http://localhost:3000) test fix CORS

This commit is contained in:
Santhosh S 2023-11-12 14:28:58 -05:00
parent b7e5e7d7fe
commit f00c7dd99c

View File

@ -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();