diff --git a/src/SelfExtendingBackend/SelfExtendingBackend.Backend/Program.cs b/src/SelfExtendingBackend/SelfExtendingBackend.Backend/Program.cs index 58caad1..88ac5a6 100644 --- a/src/SelfExtendingBackend/SelfExtendingBackend.Backend/Program.cs +++ b/src/SelfExtendingBackend/SelfExtendingBackend.Backend/Program.cs @@ -23,7 +23,10 @@ { policy.AllowAnyOrigin() .AllowAnyMethod() - .AllowAnyHeader(); + .AllowAnyHeader() + .SetIsOriginAllowed(_ => true) // Allows requests from any origin + .WithExposedHeaders("Access-Control-Allow-Origin") + .WithExposedHeaders("Access-Control-Allow-Methods"); }); }); @@ -35,11 +38,8 @@ var app = builder.Build(); -// Enable CORS globally -app.UseCors("AllowAll"); - +app.UseCors("AllowAll"); // Enable CORS first app.UseResponseCompression(); - app.UseRouting(); // List to store all dynamically registered endpoints