From bcbb46ef6643e8c296cc9ade5b0e890edb6ce1fd Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 21 Sep 2020 14:26:54 +0800 Subject: [PATCH] Handle endpoint pipelines that are different from gateways --- .../LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs index 0abc2078a..bcb56b3d7 100644 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs @@ -173,8 +173,18 @@ namespace LINGYUN.ApiGateway var app = context.GetApplicationBuilder(); app.UseAuditing(); + app.UseVirtualFiles(); app.UseRouting(); - app.UseConfiguredEndpoints(); + app.UseAuthentication(); + app.UseAbpClaimsMap(); + app.MapWhen( + ctx => ctx.Request.Path.ToString().StartsWith("/api/ApiGateway/Basic/"), + appNext => + { + // 仅针对属于网关自己的控制器进入MVC管道 + appNext.UseRouting(); + appNext.UseConfiguredEndpoints(); + }); // 启用ws协议 app.UseWebSockets(); app.UseOcelot().Wait();