diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs deleted file mode 100644 index fc0b6b82..00000000 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; - -namespace EShopOnAbp.WebPublicGateway.Controllers -{ - public class HomeController : AbpController - { - public ActionResult Index() - { - return Redirect("/swagger"); - } - } -} diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs index e9af7505..faab4ab4 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs @@ -9,6 +9,7 @@ using System.Linq; using EShopOnAbp.Shared.Hosting.AspNetCore; using Volo.Abp; using Volo.Abp.Modularity; +using Microsoft.AspNetCore.Rewrite; namespace EShopOnAbp.WebPublicGateway; @@ -75,14 +76,11 @@ public class EShopOnAbpWebPublicGatewayModule : AbpModule options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } }); - app.MapWhen( - ctx => ctx.Request.Path.ToString().TrimEnd('/').Equals(""), - app2 => - { - app2.UseRouting(); - app2.UseConfiguredEndpoints(); - } - ); + + app.UseRewriter(new RewriteOptions() + // Regex for "", "/" and "" (whitespace) + .AddRedirect("^(|\\|\\s+)$", "/swagger")); + app.UseOcelot().Wait(); } } \ No newline at end of file diff --git a/gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs b/gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs deleted file mode 100644 index 6ddeb9bc..00000000 --- a/gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; - -namespace EShopOnAbp.WebGateway.Controllers -{ - public class HomeController : AbpController - { - public ActionResult Index() - { - return Redirect("/swagger"); - } - } -} diff --git a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs index 87974f87..a9bf6190 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs @@ -11,6 +11,7 @@ using System.Linq; using EShopOnAbp.Shared.Hosting.AspNetCore; using Volo.Abp; using Volo.Abp.Modularity; +using Microsoft.AspNetCore.Rewrite; namespace EShopOnAbp.WebGateway; @@ -98,14 +99,11 @@ public class EShopOnAbpWebGatewayModule : AbpModule options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } }); - app.MapWhen( - ctx => ctx.Request.Path.ToString().TrimEnd('/').Equals(""), - app2 => - { - app2.UseRouting(); - app2.UseConfiguredEndpoints(); - } - ); + + app.UseRewriter(new RewriteOptions() + // Regex for "", "/" and "" (whitespace) + .AddRedirect("^(|\\|\\s+)$", "/swagger")); + app.UseOcelot().Wait(); } } \ No newline at end of file