Fix issue with CORS not working properly

This commit is contained in:
Jordan Dominion
2023-10-29 16:23:00 -04:00
parent 5b615ea04b
commit 78669f486c
@@ -472,6 +472,9 @@ namespace Tgstation.Server.Host.Core
logger.LogTrace("Swagger API generation enabled");
}
// Enable endpoint routing
applicationBuilder.UseRouting();
// Set up CORS based on configuration if necessary
Action<CorsPolicyBuilder> corsBuilder = null;
if (controlPanelConfiguration.AllowAnyOrigin)
@@ -514,9 +517,6 @@ namespace Tgstation.Server.Host.Core
logger.LogTrace("Web control panel disabled!");
#endif
// Stack overflow said this needs to go here and removing it breaks things: https://stackoverflow.com/questions/73736879/invalidoperationexception-endpointroutingmiddleware-matches-endpoints-setup-by
applicationBuilder.UseRouting();
// authenticate JWT tokens using our security pipeline if present, returns 401 if bad
applicationBuilder.UseAuthentication();