Details
Enable CORS in ASP.NET Core WebAPI
Register the following service to the DI container
builder.Services.AddCors(options =>
{
options.AddPolicy("ApiCorsPolicy",
policy =>
policy.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin());
});
And then add the following line after calling builder.build();
app.UseCors("ApiCorsPolicy");
Note that this is a quick and dirty way
of allowing any origin to access your api!