Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
883315bc30 | ||
|
|
4ed517ac90 | ||
|
|
eacbbc3071 | ||
|
|
ee3a3a9d56 | ||
|
|
61672c5770 |
@@ -3,20 +3,7 @@ name: PublishNugetPackage
|
||||
on: [create]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.101'
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
name: Publish Project to Nuget
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -24,11 +11,11 @@ jobs:
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.101'
|
||||
dotnet-version: '5.0.100'
|
||||
- name: Publish
|
||||
run: |
|
||||
version=`git describe --tags`
|
||||
dotnet pack --configuration release -p:PackageVersion=$version
|
||||
dotnet build --configuration release -p:PackageVersion=$version
|
||||
dotnet nuget push bin/release/Simcu.SimApi.$version.nupkg -k ${NUGET_APIKEY} -s https://www.nuget.org/api/v2/package
|
||||
env:
|
||||
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
|
||||
|
||||
+12
-2
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
using SimApi.Middlewares;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
|
||||
namespace SimApi
|
||||
{
|
||||
@@ -28,7 +29,16 @@ namespace SimApi
|
||||
public static IServiceCollection AddSimApi(this IServiceCollection builder, string title,
|
||||
string description = null)
|
||||
{
|
||||
return builder.AddSimApiAuth().AddSimApiDoc(title, description).AddCors().AddSimApiUpload();
|
||||
return builder.AddSimApiAuth().AddSimApiDoc(title, description).AddCors().AddSimApiUpload().Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
|
||||
ForwardedHeaders.XForwardedProto;
|
||||
// Only loopback proxies are allowed by default.
|
||||
// Clear that restriction because forwarders are enabled by explicit
|
||||
// configuration.
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
}); ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,7 +51,7 @@ namespace SimApi
|
||||
/// <returns></returns>
|
||||
public static IApplicationBuilder UseSimApi(this IApplicationBuilder builder, params SubmitMethod[] submitMethods)
|
||||
{
|
||||
return builder.UseSimApiException().UseSimApiDoc(submitMethods).UseMiddleware<SimApiAuthMiddleware>().UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()).UseSimApiUpload();
|
||||
return builder.UseSimApiException().UseSimApiDoc(submitMethods).UseMiddleware<SimApiAuthMiddleware>().UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()).UseSimApiUpload().UseForwardedHeaders();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user