This commit is contained in:
2025-09-03 17:54:49 -03:00
parent cb329da04e
commit ef3967fcd6
2 changed files with 12 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Elecciones.Database.Entities;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.HttpOverrides;
// Esta es la estructura estándar y recomendada.
var builder = WebApplication.CreateBuilder(args);
@@ -69,9 +70,19 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
// 3. Construir la aplicación.
var app = builder.Build();
app.UseForwardedHeaders();
// Seeder para el usuario admin
using (var scope = app.Services.CreateScope())
{