diff --git a/YABA.API/Program.cs b/YABA.API/Program.cs index bb8e69c..b9ae8be 100644 --- a/YABA.API/Program.cs +++ b/YABA.API/Program.cs @@ -103,4 +103,12 @@ app.MapControllers(); // Add custom middlewares app.UseMiddleware(); +app.UseCors(x => x + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader()); + +var webClientUrl = configuration.GetSection("WebClient").GetValue("Url"); +app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().WithOrigins(webClientUrl)); + app.Run(); diff --git a/YABA.API/appsettings.json b/YABA.API/appsettings.json index d9d9a9b..117c848 100644 --- a/YABA.API/appsettings.json +++ b/YABA.API/appsettings.json @@ -6,5 +6,7 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "WebClient": { + "Url": "https://localhost:3000" + } }