From c7f4aad99d2d4bc6f53d6115945d88f0215d6985 Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Sun, 17 May 2026 08:47:20 +0200 Subject: [PATCH] Added support for header forwarding --- ShopAdmin/Program.cs | 8 +++++++- ShopAdmin/ShopAdmin.csproj | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ShopAdmin/Program.cs b/ShopAdmin/Program.cs index 34ce093..cae3ff0 100644 --- a/ShopAdmin/Program.cs +++ b/ShopAdmin/Program.cs @@ -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(options => +{ + options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; + options.KnownProxies.Clear(); +}); + var app = builder.Build(); var schedulerFactory = app.Services.GetRequiredService(); @@ -105,6 +110,7 @@ app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: app.UseHttpsRedirection(); app.UseAntiforgery(); +app.UseForwardedHeaders(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/ShopAdmin/ShopAdmin.csproj b/ShopAdmin/ShopAdmin.csproj index 309dd4e..543805d 100644 --- a/ShopAdmin/ShopAdmin.csproj +++ b/ShopAdmin/ShopAdmin.csproj @@ -57,6 +57,8 @@ + +