From 200924e02d83f1d358e6c46ffa38a919856dde22 Mon Sep 17 00:00:00 2001 From: Sergey Karmanov Date: Thu, 2 Jan 2025 16:53:46 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20=D1=85=D0=B5=D0=B4=D0=B5=D1=80=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Otchinslator/Program.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Otchinslator/Program.cs b/src/Otchinslator/Program.cs index 07b22a4..6b9c4f4 100644 --- a/src/Otchinslator/Program.cs +++ b/src/Otchinslator/Program.cs @@ -2,6 +2,7 @@ using Gotenberg.Sharp.API.Client; using Gotenberg.Sharp.API.Client.Domain.Settings; using Gotenberg.Sharp.API.Client.Extensions; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.Identity.Web; using Microsoft.Identity.Web.UI; @@ -19,6 +20,12 @@ builder.Services.AddControllersWithViews(options => .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }).AddMicrosoftIdentityUI().AddDataAnnotationsLocalization(); +builder.Services.Configure(options => +{ + options.KnownNetworks.Clear(); + options.KnownProxies.Clear(); + options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; +}); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); @@ -41,6 +48,7 @@ if (!app.Environment.IsDevelopment()) app.UseStaticFiles(); app.UseAntiforgery(); app.MapControllers(); +app.UseForwardedHeaders(); app.MapRazorComponents(); // .AddInteractiveServerRenderMode();