Add forwarded headers
All checks were successful
Build, Push and Run Container / build (push) Successful in 29s

This commit is contained in:
2025-10-15 19:32:23 +02:00
parent 6ac6d05f5f
commit 84dc22f324
2 changed files with 15 additions and 1 deletions

View File

@@ -39,6 +39,20 @@ builder.Services.AddHttpClient().AddHttpClient("InsecureClient")
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
});
// If you know your proxy IP(s), specify them for security.
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto |
ForwardedHeaders.XForwardedHost;
// Trust specific proxy or network:
options.KnownProxies.Clear();
options.KnownNetworks.Clear();
options.ForwardLimit = null; // but prefer being explicit when possible
});
builder.Services
.AddAuthentication(o =>
{