From e392f5a7b8b0f7a5102b5cc6a283cff9be58a8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szak=C3=A1ts=20Alp=C3=A1r=20Zsolt?= Date: Sat, 16 Aug 2025 22:14:35 +0200 Subject: [PATCH] Configures forwarded headers for the application Ensures the application correctly handles forwarded headers by explicitly setting the `ForwardedHeaders` option to `ForwardedHeaders.All`. This allows the application to properly determine the client's IP address and other request information when behind a proxy or load balancer. --- Source/ProofOfConcept/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/ProofOfConcept/Program.cs b/Source/ProofOfConcept/Program.cs index 07a2c74..6ef64ee 100644 --- a/Source/ProofOfConcept/Program.cs +++ b/Source/ProofOfConcept/Program.cs @@ -2,6 +2,7 @@ using System.Text.Json; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.OpenIdConnect; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Diagnostics.HealthChecks; @@ -94,7 +95,7 @@ builder.Services.AddHostedService(); //Build app WebApplication app = builder.Build(); -app.UseForwardedHeaders(); +app.UseForwardedHeaders(new ForwardedHeadersOptions() { ForwardedHeaders = ForwardedHeaders.All }); if (app.Environment.IsDevelopment()) {