Propuesto
2026-05-22
UMS actualmente usa nginx embebido dentro de la imagen Docker ums.web-app como servidor de archivos estáticos y proxy reverso al backend API. Este enfoque es cohesivo y suficiente para un único cliente web.
La evolución SaaS planeada introduce al menos dos superficies de cliente distintas:
ums.web-app — browser SPA (React + Vite)ums.mobile-app — aplicación móvil nativa (futuro)Con múltiples clientes, el proxy reverso nginx embebido se convierte en un pasivo:
UMS ya tiene Yarp.ReverseProxy como dependencia declarada en Ums.Presentation, y la abstracción existente IAuthenticationPort es gateway-compatible. La tecnología ya está presente en el stack.
Introducir ums.gateway como una aplicación ASP.NET Core dedicada usando YARP como API Gateway centralizado para todos los clientes UMS.
El gateway será el único punto de entrada para todo el tráfico inbound. nginx se reducirá a un servidor de archivos estático puro sin responsabilidad de proxy.
| Concern | Dueño Actual | Dueño Objetivo |
|---|---|---|
| Servición de archivos estáticos (SPA) | nginx | nginx (sin cambios) |
| Proxy reverso a API | nginx (por cliente) | YARP gateway (centralizado) |
| Headers de seguridad | nginx.conf | YARP middleware |
| Rate limiting | No implementado | YARP + IPartitionedRateLimiter |
| Routing de tenant | No implementado | YARP gateway |
| Acceso API móvil | Directo a API | YARP gateway |
| Validación de token auth | Capa API | YARP gateway (pre-routing) |
Internet
│
▼
┌──────────────────────────────┐
│ ums.gateway (YARP) │ port 443 / 80
│ ASP.NET Core │ Security headers, Rate limit,
│ │ Tenant routing, Auth check
└────────────┬─────────────────┘
│
┌────────┴──────────┐
▼ ▼
┌──────────┐ ┌──────────────┐
│ ums.api │ │ ums.web-app │ nginx: static only
│ :8080 │ │ :80 │ no proxy logic
└──────────┘ └──────────────┘
▲
ums.mobile-app
(future client,
routes via gateway)
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
Todos los headers de seguridad, políticas CSP, y configuración de proxy migran al YARP gateway.
Este ADR es Propuesto y no debe implementarse hasta que comience el desarrollo del cliente móvil. El enfoque actual de nginx-embedded permanece válido para el MVP con un único cliente web.
La implementación se activa cuando cualquiera de las siguientes ocurre:
ums.mobile-app es creado.IPartitionedRateLimiter se integra nativamente con el contexto de tenant de UMS, habilitando rate limiting por tenant sin herramientas externas.ums.gateway) al Docker Compose y futuros manifiestos de Kubernetes.Yarp.ReverseProxy ya presente en Ums.Presentation — debería moverse al nuevo proyecto gateway.ums/src/apps/ums.web-app/nginx.conf| Índice ADR | Portal de Arquitectura |