diff --git a/Program.cs b/Program.cs index 8bbdd5f..b110585 100644 --- a/Program.cs +++ b/Program.cs @@ -19,6 +19,7 @@ using Serilog; using Serilog.Events; using Serilog.Sinks.SystemConsole.Themes; using Microsoft.AspNetCore.Mvc.Razor; +using Microsoft.AspNetCore.HttpOverrides; var builder = WebApplication.CreateBuilder(args); @@ -135,7 +136,6 @@ builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationSc options.ClientId = builder.Configuration["Authentication:Microsoft:ClientId"]; options.ClientSecret = builder.Configuration["Authentication:Microsoft:ClientSecret"]; - // ADICIONE ESTAS LINHAS: options.AuthorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"; options.TokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token"; @@ -221,8 +221,17 @@ builder.Services.AddHealthChecks() .AddCheck("resources") .AddCheck("external_services"); +builder.Services.Configure(options => +{ + options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; + options.KnownProxies.Clear(); + options.KnownNetworks.Clear(); +}); + var app = builder.Build(); +app.UseForwardedHeaders(); + // Configure the HTTP request pipeline if (!app.Environment.IsDevelopment()) {