From 05aab1bfa422198d9f334e83d7723496d0b37b44 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Tue, 3 Dec 2024 15:05:55 +0100 Subject: [PATCH] Added useless origin to cors --- ManagerService/Startup.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ManagerService/Startup.cs b/ManagerService/Startup.cs index 373c057..2bf8eba 100644 --- a/ManagerService/Startup.cs +++ b/ManagerService/Startup.cs @@ -166,7 +166,23 @@ namespace ManagerService app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); - app.UseCors("AllowAll"); + //app.UseCors("AllowAll"); + + app.UseCors( +#if DEBUG + options => options + .SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "http://localhost:8081") + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials() +#else + options => options + .SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "https://manager.myinfomate.be") + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials() +#endif + ); app.UseEndpoints(endpoints => {