Updated CORS with POST specific with Surveys

This commit is contained in:
Santhosh S 2023-11-11 22:00:06 -05:00
parent 43eb29c2e8
commit b7e5e7d7fe

View File

@ -34,9 +34,23 @@ builder.Services.AddAuthentication(item =>
}); });
// CORS setup to allow requests from any origin. // CORS setup to allow requests from any origin.
builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => { //builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin(); // build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
})); //}));
builder.Services.AddCors(options =>
{
options.AddPolicy("DamageAppCorsPolicy", builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.WithMethods("POST") // Allowing only the POST method
.AllowAnyOrigin();
});
});
// Add controller services and API Explorer for endpoint discovery. // Add controller services and API Explorer for endpoint discovery.
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle