diff --git a/GermanApp/Program.cs b/GermanApp/Program.cs index 841bb3e..3321396 100644 --- a/GermanApp/Program.cs +++ b/GermanApp/Program.cs @@ -95,7 +95,16 @@ try { builder.AllowAnyOrigin() .AllowAnyMethod() - .AllowAnyHeader(); + .AllowAnyHeader() + .AllowCredentials(); + }); + + options.AddPolicy("Development", builder => + { + builder.WithOrigins("http://localhost:5173", "http://localhost:5174", "http://localhost:5175", "http://localhost:3000") + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials(); }); }); @@ -245,6 +254,9 @@ try // Use exception middleware first (to catch all exceptions) app.UseExceptionMiddleware(); + // Use CORS - must be early in the pipeline, before UseAuthorization + app.UseCors("AllowAll"); + // Serve static files (audio, etc.) app.UseStaticFiles(); @@ -259,9 +271,6 @@ try app.UseAuthentication(); app.UseAuthorization(); - // Use CORS - app.UseCors("AllowAll"); - // Use Health Checks app.MapHealthChecks("/health");