Browse Source
Merge pull request #76 from abpframework/enisn/rewrite-in-gateways
Remove controllers from gateways and add rewrite options
pull/77/head
Galip Tolga Erdem
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
12 additions and
42 deletions
-
gateways/web-public/src/EShopOnAbp.WebPublicGateway/Controllers/HomeController.cs
-
gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs
-
gateways/web/src/EShopOnAbp.WebGateway/Controllers/HomeController.cs
-
gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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(); |
|
|
|
} |
|
|
|
} |