Added support for header forwarding #12

Merged
khwezi merged 1 commits from notifications into master 2026-05-17 08:48:02 +02:00
2 changed files with 9 additions and 1 deletions
+7 -1
View File
@@ -1,6 +1,5 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using Microsoft.AspNetCore.Authentication;
using ShopAdmin.Components;
using static LiteCharms.Features.Email.Extensions.Constants;
@@ -82,6 +81,12 @@ builder.Services.AddAuthentication(options =>
};
});
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownProxies.Clear();
});
var app = builder.Build();
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
@@ -105,6 +110,7 @@ app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages:
app.UseHttpsRedirection();
app.UseAntiforgery();
app.UseForwardedHeaders();
app.UseAuthentication();
app.UseAuthorization();
+2
View File
@@ -57,6 +57,8 @@
<!-- Shared Global Usings -->
<ItemGroup>
<Using Include="Microsoft.AspNetCore.HttpOverrides" />
<Using Include="Microsoft.AspNetCore.Authentication" />
<Using Include="Blazored.Toast" />
<Using Include="Quartz" />
<Using Include="Mediator" />