Browse Source
Merge pull request #1591 from abpframework/maliming/cors
Add the AbpExposeHeaders extension method.
pull/1600/head
Halil İbrahim Kalkan
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
19 additions and
0 deletions
-
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Cors/AbpCorsPolicyBuilderExtensions.cs
-
framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
|
|
|
@ -0,0 +1,12 @@ |
|
|
|
using Microsoft.AspNetCore.Cors.Infrastructure; |
|
|
|
|
|
|
|
namespace Microsoft.AspNetCore.Cors |
|
|
|
{ |
|
|
|
public static class AbpCorsPolicyBuilderExtensions |
|
|
|
{ |
|
|
|
public static CorsPolicyBuilder WithAbpExposedHeaders(this CorsPolicyBuilder corsPolicyBuilder) |
|
|
|
{ |
|
|
|
return corsPolicyBuilder.WithExposedHeaders("_AbpErrorFormat"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -32,6 +32,7 @@ |
|
|
|
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" /> |
|
|
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" /> |
|
|
|
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" /> |
|
|
|
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" /> |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
</Project> |
|
|
|
|
|
|
|
@ -2,6 +2,7 @@ |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
@ -134,6 +135,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
.Select(o => o.RemovePostFix("/")) |
|
|
|
.ToArray() |
|
|
|
) |
|
|
|
.WithAbpExposedHeaders() |
|
|
|
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|
|
|
.AllowAnyHeader() |
|
|
|
.AllowAnyMethod() |
|
|
|
|
|
|
|
@ -3,6 +3,7 @@ using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
@ -133,6 +134,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
.Select(o => o.RemovePostFix("/")) |
|
|
|
.ToArray() |
|
|
|
) |
|
|
|
.WithAbpExposedHeaders() |
|
|
|
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|
|
|
.AllowAnyHeader() |
|
|
|
.AllowAnyMethod() |
|
|
|
|
|
|
|
@ -3,6 +3,7 @@ using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
@ -114,6 +115,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
.Select(o => o.RemovePostFix("/")) |
|
|
|
.ToArray() |
|
|
|
) |
|
|
|
.WithAbpExposedHeaders() |
|
|
|
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|
|
|
.AllowAnyHeader() |
|
|
|
.AllowAnyMethod() |
|
|
|
|