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();