I solved this problem after not finding the solution on Stackoverflow, so I am sharing my problem here and the solution in an answer.
After enabling a cross domain p
I want to put a specific answer for my specific situation where i was testing both the api and the client web app locally. I know this is a late entry but CORS has changed so much in dot net core, i thought, newcomers like me might benefit with a full post.
For me, it was two issues that occurred back to back.
First, this goes to public void ConfigureServices(IServiceCollection services)
//lets add some CORS stuff
services.AddCors(options =>
{
options.AddDefaultPolicy(builder => {
builder.WithOrigins("http://localhost:3000",
"http://www.contoso.com");
builder.AllowAnyMethod();
builder.AllowAnyHeader();
builder.AllowCredentials();
});
});
and then, this, goes to, public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseCors();