Fix: Servir assets estáticos sin autenticación
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 24s

Problema:
- Los assets (CSS/JS) estaban siendo bloqueados por Authentik
- El servidor devolvía HTML (página de login) en lugar de CSS
- Error: MIME type 'text/html' is not a supported stylesheet

Solución:
- Crear dos routers en Traefik:
  1. Router público (prioridad 100): /assets, /icons, manifest, favicon SIN autenticación
  2. Router principal (prioridad 10): Todo lo demás CON autenticación
- Los assets estáticos ahora se sirven directamente sin pasar por Authentik
- Mantiene la seguridad para el resto de la aplicación

Rutas públicas: /assets/*, /.well-known/*, /icons/*, /manifest.webmanifest, /favicon.ico
This commit is contained in:
2025-10-17 04:29:25 -06:00
parent cba732fbca
commit ad18d22c7e

View File

@@ -27,19 +27,28 @@ services:
- "traefik.enable=true"
- "traefik.docker.network=principal"
# Router principal
- "traefik.http.routers.wifi-nucleoriofrio.rule=Host(`wifi.nucleoriofrio.com`)"
- "traefik.http.routers.wifi-nucleoriofrio.entrypoints=websecure"
- "traefik.http.routers.wifi-nucleoriofrio.tls.certresolver=letsencrypt"
- "traefik.http.routers.wifi-nucleoriofrio.service=wifi-nucleoriofrio-service"
- "traefik.http.routers.wifi-nucleoriofrio.middlewares=authentik-forward-auth@file,wifi-headers@docker"
# Service - Puerto y configuraciones SSE
# Service - Puerto y configuraciones SSE (compartido por ambos routers)
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.server.port=3000"
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.passhostheader=true"
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.responseforwarding.flushinterval=1ms"
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.serverstransport=wifi-transport@docker"
# Router 1: Público (assets estáticos, manifest, icons) - SIN autenticación - ALTA PRIORIDAD
- "traefik.http.routers.wifi-nucleoriofrio-public.rule=Host(`wifi.nucleoriofrio.com`) && (PathPrefix(`/assets`) || PathPrefix(`/.well-known`) || PathPrefix(`/icons`) || Path(`/manifest.webmanifest`) || Path(`/favicon.ico`) || Path(`/vite.svg`))"
- "traefik.http.routers.wifi-nucleoriofrio-public.entrypoints=websecure"
- "traefik.http.routers.wifi-nucleoriofrio-public.tls.certresolver=letsencrypt"
- "traefik.http.routers.wifi-nucleoriofrio-public.service=wifi-nucleoriofrio-service"
- "traefik.http.routers.wifi-nucleoriofrio-public.priority=100"
- "traefik.http.routers.wifi-nucleoriofrio-public.middlewares=wifi-headers@docker"
# Router 2: Principal (todo lo demás) - CON autenticación - BAJA PRIORIDAD
- "traefik.http.routers.wifi-nucleoriofrio.rule=Host(`wifi.nucleoriofrio.com`)"
- "traefik.http.routers.wifi-nucleoriofrio.entrypoints=websecure"
- "traefik.http.routers.wifi-nucleoriofrio.tls.certresolver=letsencrypt"
- "traefik.http.routers.wifi-nucleoriofrio.service=wifi-nucleoriofrio-service"
- "traefik.http.routers.wifi-nucleoriofrio.priority=10"
- "traefik.http.routers.wifi-nucleoriofrio.middlewares=authentik-forward-auth@file,wifi-headers@docker"
# Middleware: wifi-headers
- "traefik.http.middlewares.wifi-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.middlewares.wifi-headers.headers.customrequestheaders.X-Forwarded-Scheme=https"