diff --git a/Webshop.Api/Program.cs b/Webshop.Api/Program.cs index c277e72..fbf72c8 100644 --- a/Webshop.Api/Program.cs +++ b/Webshop.Api/Program.cs @@ -35,15 +35,21 @@ var options = new WebApplicationOptions var builder = WebApplication.CreateBuilder(options); +var allowedOrigins = new string[] +{ + "https://webshop.tzbre.dev", + "http://localhost:4200" +}; + builder.Services.AddCors(options => { - options.AddPolicy("AllowNuxtApp", - policy => - { - policy.WithOrigins("http://localhost:3000") - .AllowAnyHeader() - .AllowAnyMethod(); - }); + options.AddPolicy(name: "AllowSpecificOrigins", + policy => + { + policy.WithOrigins(allowedOrigins) + .AllowAnyHeader() + .AllowAnyMethod(); + }); }); // --- 1. Dependency Injection Konfiguration --- @@ -300,8 +306,8 @@ app.UseStaticFiles(); // Swagger/SwaggerUI für API-Dokumentation aktivieren //'if (app.Environment.IsDevelopment()) //{ - app.UseSwagger(); - app.UseSwaggerUI(); +app.UseSwagger(); +app.UseSwaggerUI(); //} // app.UseHttpsRedirection(); // Auskommentiert für Docker HTTP-Entwicklung