Skip to content

Commit

Permalink
UseForwardedHeaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Expecho committed Dec 11, 2024
1 parent 1511f12 commit b340880
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/PolicyInitiativeBuilder/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Azure.Monitor.OpenTelemetry.AspNetCore;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Identity.Web;
Expand All @@ -14,6 +15,11 @@
builder.Services.AddControllersWithViews()
.AddMicrosoftIdentityUI();

builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});

var initialScopes = new[] { "https://management.azure.com/user_impersonation" };

builder.Services.AddOpenTelemetry().UseAzureMonitor();
Expand Down Expand Up @@ -86,6 +92,7 @@
app.UseStaticFiles();
app.UseRouting();
app.UseAntiforgery();
app.UseForwardedHeaders();
app.MapControllers();
app.MapRazorPages();
app.MapStaticAssets();
Expand Down

0 comments on commit b340880

Please sign in to comment.