Listo para Producción!
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 16m22s
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 16m22s
This commit is contained in:
@@ -95,7 +95,7 @@ builder.Services.AddScoped<IReportesService, ReportesService>();
|
||||
|
||||
// --- Configuración de Autenticación JWT ---
|
||||
var jwtSettings = builder.Configuration.GetSection("Jwt");
|
||||
var jwtKey = jwtSettings["Key"] ?? throw new ArgumentNullException("Jwt:Key", "JWT Key not configured in appsettings");
|
||||
var jwtKey = builder.Configuration["JWT_KEY"] ?? jwtSettings["Key"] ?? throw new ArgumentNullException("Jwt:Key", "JWT Key not configured");
|
||||
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
||||
|
||||
builder.Services.AddAuthentication(options =>
|
||||
@@ -129,13 +129,14 @@ var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: MyAllowSpecificOrigins,
|
||||
policy =>
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5173") // URL Frontend React
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
// Para pruebas más permisivas (NO USAR EN PRODUCCIÓN):
|
||||
// policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
|
||||
policy.WithOrigins(
|
||||
"http://localhost:5173", // Para desarrollo local
|
||||
"http://192.168.4.128:8080" // Para producción
|
||||
)
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
// --- Fin CORS ---
|
||||
|
||||
Reference in New Issue
Block a user