Fix хедеров
All checks were successful
Build and deploy / Publish image (push) Successful in 1m4s

This commit is contained in:
2025-01-02 16:53:46 +03:00
parent 98995f3dbf
commit 200924e02d

View File

@@ -2,6 +2,7 @@ using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Settings; using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Extensions; using Gotenberg.Sharp.API.Client.Extensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Identity.Web; using Microsoft.Identity.Web;
using Microsoft.Identity.Web.UI; using Microsoft.Identity.Web.UI;
@@ -19,6 +20,12 @@ builder.Services.AddControllersWithViews(options =>
.Build(); .Build();
options.Filters.Add(new AuthorizeFilter(policy)); options.Filters.Add(new AuthorizeFilter(policy));
}).AddMicrosoftIdentityUI().AddDataAnnotationsLocalization(); }).AddMicrosoftIdentityUI().AddDataAnnotationsLocalization();
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});
// Add services to the container. // Add services to the container.
builder.Services.AddRazorComponents() builder.Services.AddRazorComponents()
.AddInteractiveServerComponents(); .AddInteractiveServerComponents();
@@ -41,6 +48,7 @@ if (!app.Environment.IsDevelopment())
app.UseStaticFiles(); app.UseStaticFiles();
app.UseAntiforgery(); app.UseAntiforgery();
app.MapControllers(); app.MapControllers();
app.UseForwardedHeaders();
app.MapRazorComponents<App>(); app.MapRazorComponents<App>();
// .AddInteractiveServerRenderMode(); // .AddInteractiveServerRenderMode();