From ef3967fcd670fe479c774d20db805571544c0f69 Mon Sep 17 00:00:00 2001 From: dmolinari Date: Wed, 3 Sep 2025 17:54:49 -0300 Subject: [PATCH] Fix 1754 --- Elecciones-Web/frontend/src/apiService.ts | 2 +- Elecciones-Web/src/Elecciones.Api/Program.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Elecciones-Web/frontend/src/apiService.ts b/Elecciones-Web/frontend/src/apiService.ts index 2ce7fdc..9f7cf8b 100644 --- a/Elecciones-Web/frontend/src/apiService.ts +++ b/Elecciones-Web/frontend/src/apiService.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import type { ProyeccionBancas, MunicipioSimple, TelegramaData, CatalogoItem, CategoriaResumen, ResultadoTicker, ApiResponseResultadosPorSeccion } from './types/types'; -const API_BASE_URL = 'http://localhost:5217/api'; +const API_BASE_URL = '/api'; const apiClient = axios.create({ baseURL: API_BASE_URL, diff --git a/Elecciones-Web/src/Elecciones.Api/Program.cs b/Elecciones-Web/src/Elecciones.Api/Program.cs index d68a357..70af2f8 100644 --- a/Elecciones-Web/src/Elecciones.Api/Program.cs +++ b/Elecciones-Web/src/Elecciones.Api/Program.cs @@ -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(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()) {