Browse Source

Merge pull request #261 from colinin/4.3

upgrade cap to 5.0.2
pull/274/head
cKey 5 years ago
committed by GitHub
parent
commit
c486586eb2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 7
      aspnet-core/LINGYUN.MicroService.ApiGateway.sln
  3. 7
      aspnet-core/LINGYUN.MicroService.Common.sln
  4. 2
      aspnet-core/configuration/account/AuthServer.Host/appsettings.Development.json
  5. 2
      aspnet-core/configuration/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/appsettings.Development.json
  6. 2
      aspnet-core/configuration/apigateway/LINGYUN.ApiGateway.Host/appsettings.Development.json
  7. 2
      aspnet-core/configuration/apigateway/LINGYUN.ApiGateway.HttpApi.Host/appsettings.Development.json
  8. 2
      aspnet-core/configuration/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/appsettings.Development.json
  9. 2
      aspnet-core/configuration/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/appsettings.Development.json
  10. 2
      aspnet-core/configuration/messages/LINGYUN.Abp.MessageService.HttpApi.Host/appsettings.Development.json
  11. 2
      aspnet-core/configuration/platform/LINGYUN.Platform.HttpApi.Host/appsettings.Development.json
  12. 14
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj
  13. 25
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/HttpOverrides/AbpAspNetCoreHttpOverridesModule.cs
  14. 36
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/HttpOverrides/Forwarded/AbpForwardedHeadersOptions.cs
  15. 43
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/WebClientInfo/RequestForwardedHeaderWebClientInfoProvider.cs
  16. 67
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/Microsoft/AspNetCore/Builder/ForwardedHeadersOptionsExtensions.cs
  17. 32
      aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/README.md
  18. 2
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
  19. 2
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs
  20. 10
      aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj
  21. 10
      aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/LINGYUN.Abp.BackendAdmin.HttpApi.Host.csproj
  22. 11
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs
  23. 11
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN.ApiGateway.Host.csproj
  24. 9
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Properties/launchSettings.json
  25. 6
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj
  26. 10
      aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/LINGYUN.Abp.IdentityServer4.HttpApi.Host.csproj
  27. 10
      aspnet-core/services/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/LINGYUN.Abp.LocalizationManagement.HttpApi.Host.csproj
  28. 10
      aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj
  29. 10
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj

7
aspnet-core/LINGYUN.MicroService.All.sln

@ -329,6 +329,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.RulesEngi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.RulesEngine.Tests", "tests\LINGYUN.Abp.Rules.RulesEngine.Tests\LINGYUN.Abp.Rules.RulesEngine.Tests.csproj", "{8EF31071-3521-409D-9740-BBFBFC04C50E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.HttpOverrides", "modules\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj", "{13219C1C-23E1-4EBA-93FB-86830C93A800}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -859,6 +861,10 @@ Global
{8EF31071-3521-409D-9740-BBFBFC04C50E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EF31071-3521-409D-9740-BBFBFC04C50E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EF31071-3521-409D-9740-BBFBFC04C50E}.Release|Any CPU.Build.0 = Release|Any CPU
{13219C1C-23E1-4EBA-93FB-86830C93A800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13219C1C-23E1-4EBA-93FB-86830C93A800}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13219C1C-23E1-4EBA-93FB-86830C93A800}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13219C1C-23E1-4EBA-93FB-86830C93A800}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1021,6 +1027,7 @@ Global
{34BB9810-2983-4E55-A96A-132D32310145} = {6084D52D-775B-4A39-8CD5-AA2F362B5A61}
{4D83BDA7-2059-41C7-85AE-FEFAD5CD9498} = {6084D52D-775B-4A39-8CD5-AA2F362B5A61}
{8EF31071-3521-409D-9740-BBFBFC04C50E} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{13219C1C-23E1-4EBA-93FB-86830C93A800} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

7
aspnet-core/LINGYUN.MicroService.ApiGateway.sln

@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{D6629D
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EventBus.CAP", "modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj", "{1DA1835B-9EA4-4095-A8CF-10E2778206D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.HttpOverrides", "modules\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj", "{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -77,6 +79,10 @@ Global
{1DA1835B-9EA4-4095-A8CF-10E2778206D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DA1835B-9EA4-4095-A8CF-10E2778206D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DA1835B-9EA4-4095-A8CF-10E2778206D3}.Release|Any CPU.Build.0 = Release|Any CPU
{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -94,6 +100,7 @@ Global
{4757C7D9-6AE9-477D-9829-55D9906AC3E6} = {AD93DD04-989C-40BE-A3F4-25DABF290423}
{D6629DD3-BA0F-44B5-A97F-3B992ECAB85D} = {630FB448-8C5C-438F-930D-B0209407DE6A}
{1DA1835B-9EA4-4095-A8CF-10E2778206D3} = {D6629DD3-BA0F-44B5-A97F-3B992ECAB85D}
{7588F35B-7C0E-4D80-B43A-8A5C9AC6FE03} = {D6629DD3-BA0F-44B5-A97F-3B992ECAB85D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B327C65A-BD15-480D-825E-9D5A870C521A}

7
aspnet-core/LINGYUN.MicroService.Common.sln

@ -156,6 +156,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr.AspNetCore
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Dapr.Actors.Tests", "tests\LINGYUN.Abp.Dapr.Actors.Tests\LINGYUN.Abp.Dapr.Actors.Tests.csproj", "{CF30221B-CA7A-42CD-B91A-B7224AB2F38B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.AspNetCore.HttpOverrides", "modules\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj", "{191BB108-546E-4E70-978E-D6A8149C319C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -406,6 +408,10 @@ Global
{CF30221B-CA7A-42CD-B91A-B7224AB2F38B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF30221B-CA7A-42CD-B91A-B7224AB2F38B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF30221B-CA7A-42CD-B91A-B7224AB2F38B}.Release|Any CPU.Build.0 = Release|Any CPU
{191BB108-546E-4E70-978E-D6A8149C319C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{191BB108-546E-4E70-978E-D6A8149C319C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{191BB108-546E-4E70-978E-D6A8149C319C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{191BB108-546E-4E70-978E-D6A8149C319C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -484,6 +490,7 @@ Global
{26E87199-F0AD-4B30-B0E4-080B12E6F8FC} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{8968EDAF-9F5C-4786-AF2A-D3928B70C3EC} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{CF30221B-CA7A-42CD-B91A-B7224AB2F38B} = {B86C21A4-73B7-471E-B73A-B4B905EC9435}
{191BB108-546E-4E70-978E-D6A8149C319C} = {086BE5BE-8594-4DA7-8819-935FEF76DABD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06C707C6-02C0-411A-AD3B-2D0E13787CB8}

2
aspnet-core/configuration/account/AuthServer.Host/appsettings.Development.json

@ -41,7 +41,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "AuthServer",
"DefaultGroupName": "AuthServer",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/appsettings.Development.json

@ -34,7 +34,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "BackendAdmin",
"DefaultGroupName": "BackendAdmin",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/apigateway/LINGYUN.ApiGateway.Host/appsettings.Development.json

@ -26,7 +26,7 @@
"EnabledDynamicOcelot": true,
"CAP": {
"EventBus": {
"DefaultGroup": "ApiGateway-Host",
"DefaultGroupName": "ApiGateway-Host",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/apigateway/LINGYUN.ApiGateway.HttpApi.Host/appsettings.Development.json

@ -23,7 +23,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "ApiGateway-Admin",
"DefaultGroupName": "ApiGateway-Admin",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/appsettings.Development.json

@ -20,7 +20,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "IdentityServer4Admin",
"DefaultGroupName": "IdentityServer4Admin",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/appsettings.Development.json

@ -8,7 +8,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "Platform",
"DefaultGroupName": "Platform",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/messages/LINGYUN.Abp.MessageService.HttpApi.Host/appsettings.Development.json

@ -45,7 +45,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "MessageService",
"DefaultGroupName": "MessageService",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

2
aspnet-core/configuration/platform/LINGYUN.Platform.HttpApi.Host/appsettings.Development.json

@ -26,7 +26,7 @@
},
"CAP": {
"EventBus": {
"DefaultGroup": "Platform",
"DefaultGroupName": "Platform",
"Version": "v1",
"FailedRetryInterval": 300,
"FailedRetryCount": 10

14
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore" Version="4.3.0" />
</ItemGroup>
</Project>

25
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/HttpOverrides/AbpAspNetCoreHttpOverridesModule.cs

@ -0,0 +1,25 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AspNetCore.HttpOverrides
{
public class AbpAspNetCoreHttpOverridesModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var forwardOptions = new AbpForwardedHeadersOptions();
configuration.GetSection("Forwarded:Headers").Bind(forwardOptions);
context.Services.ExecutePreConfiguredActions(forwardOptions);
Configure<ForwardedHeadersOptions>(options =>
{
options.Configure(forwardOptions);
});
}
}
}

36
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/HttpOverrides/Forwarded/AbpForwardedHeadersOptions.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.HttpOverrides;
using System.Collections.Generic;
namespace LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded
{
public class AbpForwardedHeadersOptions
{
public string ForwardedForHeaderName { get; set; }
public string ForwardedHostHeaderName { get; set; }
public string ForwardedProtoHeaderName { get; set; }
public string OriginalForHeaderName { get; set; }
public string OriginalHostHeaderName { get; set; }
public string OriginalProtoHeaderName { get; set; }
public ForwardedHeaders ForwardedHeaders { get; set; }
public int? ForwardLimit { get; set; }
public bool RequireHeaderSymmetry { get; set; }
public List<string> AllowedHosts { get; set; }
public List<string> KnownNetworks { get; set; }
public List<string> KnownProxies { get; set; }
public AbpForwardedHeadersOptions()
{
ForwardedForHeaderName = ForwardedHeadersDefaults.XForwardedForHeaderName;
ForwardedHostHeaderName = ForwardedHeadersDefaults.XForwardedHostHeaderName;
ForwardedProtoHeaderName = ForwardedHeadersDefaults.XForwardedProtoHeaderName;
OriginalForHeaderName = ForwardedHeadersDefaults.XOriginalForHeaderName;
OriginalHostHeaderName = ForwardedHeadersDefaults.XOriginalHostHeaderName;
OriginalProtoHeaderName = ForwardedHeadersDefaults.XOriginalProtoHeaderName;
ForwardedHeaders = ForwardedHeaders.None;
ForwardLimit = 1;
RequireHeaderSymmetry = false;
AllowedHosts = new List<string>();
KnownProxies = new List<string>();
KnownNetworks = new List<string>();
}
}
}

43
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN/Abp/AspNetCore/WebClientInfo/RequestForwardedHeaderWebClientInfoProvider.cs

@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using System.Linq;
using Volo.Abp.AspNetCore.WebClientInfo;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.AspNetCore.WebClientInfo
{
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
[ExposeServices(
typeof(IWebClientInfoProvider),
typeof(HttpContextWebClientInfoProvider))]
public class RequestForwardedHeaderWebClientInfoProvider : HttpContextWebClientInfoProvider
{
protected ForwardedHeadersOptions Options { get; }
public RequestForwardedHeaderWebClientInfoProvider(
ILogger<HttpContextWebClientInfoProvider> logger,
IOptions<ForwardedHeadersOptions> options,
IHttpContextAccessor httpContextAccessor)
: base(logger, httpContextAccessor)
{
Options = options.Value;
}
protected override string GetClientIpAddress()
{
IHeaderDictionary requestHeaders = HttpContextAccessor.HttpContext?.Request?.Headers;
if (requestHeaders != null &&
requestHeaders.TryGetValue(Options.ForwardedForHeaderName, out StringValues headers) == true)
{
if (StringValues.IsNullOrEmpty(headers))
{
return headers.Last();
}
}
return base.GetClientIpAddress();
}
}
}

67
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/Microsoft/AspNetCore/Builder/ForwardedHeadersOptionsExtensions.cs

@ -0,0 +1,67 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded;
using Microsoft.AspNetCore.HttpOverrides;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace Microsoft.AspNetCore.Builder
{
public static class ForwardedHeadersOptionsExtensions
{
public static void Configure(
this ForwardedHeadersOptions options,
AbpForwardedHeadersOptions abpOptions)
{
options.ForwardedForHeaderName = abpOptions.ForwardedForHeaderName;
options.ForwardedHeaders = abpOptions.ForwardedHeaders;
options.ForwardedHostHeaderName = abpOptions.ForwardedHostHeaderName;
options.ForwardedProtoHeaderName = abpOptions.ForwardedProtoHeaderName;
options.ForwardLimit = abpOptions.ForwardLimit;
options.OriginalForHeaderName = abpOptions.OriginalForHeaderName;
options.OriginalHostHeaderName = abpOptions.OriginalHostHeaderName;
options.OriginalProtoHeaderName = abpOptions.OriginalProtoHeaderName;
options.RequireHeaderSymmetry = abpOptions.RequireHeaderSymmetry;
if (abpOptions.AllowedHosts.Any())
{
options.AllowedHosts = abpOptions.AllowedHosts;
}
AddProxies(options.KnownProxies, abpOptions.KnownProxies);
if (abpOptions.KnownNetworks.Any())
{
options.KnownNetworks.Clear();
foreach (var proxy in abpOptions.KnownNetworks)
{
// 192.168.1.0/24
var spiltProxies = proxy.Split("/");
if (spiltProxies.Length != 2)
{
continue;
}
if (int.TryParse(spiltProxies[1], out int prefixLength) &&
IPAddress.TryParse(spiltProxies[0], out IPAddress prefixIpAddress))
{
options.KnownNetworks.Add(new IPNetwork(prefixIpAddress, prefixLength));
}
}
}
}
private static void AddProxies(IList<IPAddress> addresses, IList<string> proxiesAddress)
{
if (proxiesAddress.Any())
{
addresses.Clear();
foreach (var proxy in proxiesAddress)
{
if (IPAddress.TryParse(proxy, out IPAddress iPAddress))
{
addresses.Add(iPAddress);
}
}
}
}
}
}

32
aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.HttpOverrides/README.md

@ -0,0 +1,32 @@
# LINGYUN.Abp.AspNetCore.HttpOverrides
## 模块说明
对于Http传输标头的一些重写类模块
目前实现通过解析 **X-Forwarded-For** 标头获取反向代理中的真实客户地址,通常获取标头中的最后一个设置值
### 基础模块
### 高阶模块
### 权限定义
### 功能定义
### 配置定义
### 如何使用
```csharp
[DependsOn(
typeof(AbpAspNetCoreHttpOverridesModule))]
public class YouProjectModule : AbpModule
{
}
```
### 更新日志

2
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml

@ -188,7 +188,7 @@
CAP消息扩展
</summary>
</member>
<member name="M:LINGYUN.Abp.EventBus.CAP.AbpCAPMessageExtensions.TryGetTenantId(DotNetCore.CAP.Messages.Message,System.Guid@)">
<member name="M:LINGYUN.Abp.EventBus.CAP.AbpCAPMessageExtensions.TryGetTenantId(DotNetCore.CAP.Messages.Message,System.Nullable{System.Guid}@)">
<summary>
尝试获取消息标头中的租户标识
</summary>

2
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs

@ -107,7 +107,7 @@ namespace LINGYUN.Abp.EventBus.CAP
{
if (attribute.Group == null)
{
attribute.Group = CapOptions.DefaultGroup + "." + CapOptions.Version;
attribute.Group = CapOptions.DefaultGroupName + "." + CapOptions.Version;
}
else
{

10
aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj

@ -22,17 +22,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

10
aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/LINGYUN.Abp.BackendAdmin.HttpApi.Host.csproj

@ -23,14 +23,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />

11
aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/ApiGatewayHostModule.cs

@ -1,4 +1,5 @@
using DotNetCore.CAP;
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.ApiGateway.Localization;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -19,8 +20,6 @@ using Ocelot.Provider.Polly;
using StackExchange.Redis;
using System;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using Volo.Abp;
using Volo.Abp.AspNetCore;
using Volo.Abp.Autofac;
@ -29,7 +28,6 @@ using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Http.Client.IdentityModel;
using Volo.Abp.Json;
using Volo.Abp.Json.SystemTextJson;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Security.Encryption;
@ -44,7 +42,8 @@ namespace LINGYUN.ApiGateway
typeof(AbpAutoMapperModule),
typeof(ApiGatewayHttpApiClientModule),
typeof(AbpCAPEventBusModule),
typeof(AbpAspNetCoreModule)
typeof(AbpAspNetCoreModule),
typeof(AbpAspNetCoreHttpOverridesModule)
)]
public class ApiGatewayHostModule : AbpModule
{
@ -195,8 +194,7 @@ namespace LINGYUN.ApiGateway
{
var app = context.GetApplicationBuilder();
// 网关不需要加代理中间件
app.UseForwardedHeaders();
app.UseAuditing();
app.UseStaticFiles();
app.UseRouting();
@ -210,6 +208,7 @@ namespace LINGYUN.ApiGateway
appNext.UseRouting();
appNext.UseConfiguredEndpoints();
});
// 启用ws协议
app.UseWebSockets();
app.UseOcelot().Wait();

11
aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN.ApiGateway.Host.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
@ -11,10 +11,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.Sqlite" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.Sqlite" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Ocelot.Provider.Polly" Version="16.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
@ -33,6 +33,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\apigateway\LINGYUN.ApiGateway.HttpApi.Client\LINGYUN.ApiGateway.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
</ItemGroup>

9
aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Properties/launchSettings.json

@ -13,14 +13,7 @@
"launchBrowser": false,
"applicationUrl": "http://localhost:30000;https://localhost:30443",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}

6
aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj

@ -11,9 +11,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

10
aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/LINGYUN.Abp.IdentityServer4.HttpApi.Host.csproj

@ -21,14 +21,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />

10
aspnet-core/services/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/LINGYUN.Abp.LocalizationManagement.HttpApi.Host.csproj

@ -6,14 +6,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />

10
aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj

@ -16,14 +16,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />

10
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj

@ -20,14 +20,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.1.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.0.2" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.*" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />

Loading…
Cancel
Save