Add CORS exception

This commit is contained in:
Carl Tibule
2023-02-07 22:13:26 -06:00
parent 3ace4a01f1
commit 7e48e097c0
2 changed files with 11 additions and 1 deletions

View File

@ -103,4 +103,12 @@ app.MapControllers();
// Add custom middlewares // Add custom middlewares
app.UseMiddleware<AddCustomClaimsMiddleware>(); app.UseMiddleware<AddCustomClaimsMiddleware>();
app.UseCors(x => x
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader());
var webClientUrl = configuration.GetSection("WebClient").GetValue<string>("Url");
app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().WithOrigins(webClientUrl));
app.Run(); app.Run();

View File

@ -6,5 +6,7 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"AllowedHosts": "*" "WebClient": {
"Url": "https://localhost:3000"
}
} }