Browse Source

Remove controllers and add rewrite options

ipaddr
enisn 5 years ago
parent
commit
3fbf18ca65
  1. 13
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs
  2. 14
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs
  3. 13
      gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs
  4. 14
      gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs

13
gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs

@ -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");
}
}
}

14
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();
}
}

13
gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs

@ -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");
}
}
}

14
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();
}
}
Loading…
Cancel
Save