diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Extensions/Extensions.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Extensions/Extensions.cs index feb217502..b57429ede 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Extensions/Extensions.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Extensions/Extensions.cs @@ -6,25 +6,25 @@ internal static class Extensions public static IServiceCollection AddReverseProxy(this IServiceCollection services, IConfiguration configuration) { // REVIEW: This should come from configuration - var s = new (string, string, string)[] + var s = new (string, string, string, bool)[] { - ("c-short", "c", "catalog"), - ("c-long", "catalog-api", "catalog"), + ("c-short", "c", "catalog", true), + ("c-long", "catalog-api", "catalog", true), - ("b-short", "b", "basket"), - ("b-long", "basket-api", "basket"), + ("b-short", "b", "basket", true), + ("b-long", "basket-api", "basket", true), - ("o-short", "o", "orders"), - ("o-long", "ordering-api", "orders"), + ("o-short", "o", "orders", true) , + ("o-long", "ordering-api", "orders", true), - ("h-long", "hub/notificationhub", "signalr") + ("h-long", "hub/notificationhub", "signalr", false) }; var routes = new List(); var clusters = new Dictionary(); var urls = configuration.GetRequiredSection("Urls"); - foreach (var (routeId, prefix, clusterId) in s) + foreach (var (routeId, prefix, clusterId, rewritePrefix) in s) { var destination = urls.GetRequiredValue(clusterId); @@ -36,10 +36,10 @@ internal static class Extensions { Path = $"/{prefix}/{{**catch-all}}" }, - Metadata = new Dictionary() + Metadata = rewritePrefix ? new Dictionary() { ["prefix"] = prefix - } + } : null }); clusters[clusterId] = new() diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs index 647fb422d..0babb8802 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs @@ -27,13 +27,13 @@ app.UseServiceDefaults(); app.UseHttpsRedirection(); -app.UseCors(); +app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.MapGet("/", () => Results.Redirect("/swagger")); -app.MapControllers().RequireCors("CorsPolicy"); +app.MapControllers(); app.MapReverseProxy(); await app.RunAsync(); diff --git a/src/Web/WebMVC/appsettings.json b/src/Web/WebMVC/appsettings.json index 12c8e251b..ba45dbdd8 100644 --- a/src/Web/WebMVC/appsettings.json +++ b/src/Web/WebMVC/appsettings.json @@ -1,5 +1,6 @@ { "PurchaseUrl": "http://localhost:5229", + "SignalrHubUrl": "http://localhost:5229", "IdentityUrl": "http://localhost:5223", "IdentityUrlHC": "http://localhost:5223/hc", "CallBackUrl": "http://localhost:5100/",