diff --git a/pflegepilot_v3/.env.example b/pflegepilot_v3/.env.example index 24c6258..95f9942 100644 --- a/pflegepilot_v3/.env.example +++ b/pflegepilot_v3/.env.example @@ -16,3 +16,8 @@ WEB_ORIGIN=http://localhost:3100 # --- Frontend (Next.js) --- WEB_PORT=3100 NEXT_PUBLIC_API_URL=http://localhost:8100 +# Nur noetig, wenn per LAN-IP/Hostname statt localhost zugegriffen wird +# (z.B. Deployment auf einem NAS) - sonst blockt Next.js im Dev-Modus die +# HMR-Verbindung und die App haengt bei "Laedt...". Kommagetrennt bei +# mehreren Hosts/IPs. Beispiel: NEXT_DEV_ALLOWED_ORIGINS=192.168.1.222 +NEXT_DEV_ALLOWED_ORIGINS= diff --git a/pflegepilot_v3/docker-compose.yml b/pflegepilot_v3/docker-compose.yml index c7a1718..51a7f41 100644 --- a/pflegepilot_v3/docker-compose.yml +++ b/pflegepilot_v3/docker-compose.yml @@ -38,6 +38,7 @@ services: build: ./frontend environment: NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL} + NEXT_DEV_ALLOWED_ORIGINS: ${NEXT_DEV_ALLOWED_ORIGINS:-} ports: - "${WEB_PORT:-3100}:3000" volumes: diff --git a/pflegepilot_v3/frontend/next.config.ts b/pflegepilot_v3/frontend/next.config.ts index e9ffa30..9ba03cf 100644 --- a/pflegepilot_v3/frontend/next.config.ts +++ b/pflegepilot_v3/frontend/next.config.ts @@ -1,7 +1,16 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + // Next.js' Dev-Server blockt standardmaessig Cross-Origin-Zugriffe auf + // interne Dev-Ressourcen (HMR-Websocket) von anderen Hosts als localhost. + // Noetig, sobald per LAN-IP statt localhost zugegriffen wird (z.B. Deployment + // auf einem NAS, Zugriff von einem anderen Geraet im selben Netz) - ohne das + // haengt die HMR-Verbindung, was im Turbopack-Dev-Modus die Hydration + // blockiert (Seite bleibt bei der server-gerenderten "Laedt..."-HTML stehen). + // Betrifft nur den Dev-Server, nicht den Produktions-Build aus Phase 7. + allowedDevOrigins: process.env.NEXT_DEV_ALLOWED_ORIGINS + ? process.env.NEXT_DEV_ALLOWED_ORIGINS.split(",") + : undefined, }; export default nextConfig;