diff --git a/proxy.ts b/proxy.ts index b8f4539..9d69277 100644 --- a/proxy.ts +++ b/proxy.ts @@ -37,6 +37,13 @@ const gate = auth((request) => { // Rückweg aus Entra nach /login um und die Anmeldung kommt nie zustande. if (pathname.startsWith("/api/auth")) return NextResponse.next(); + // Der nächtliche Lauf hat keine Sitzung — er weist sich mit CRON_SECRET aus, + // und das prüft die Route selbst (401 ohne passendes Geheimnis). Ohne diese + // Ausnahme leitete der Proxy ihn nach /login um, `wget` folgte der + // Weiterleitung, bekam die Anmeldeseite mit 200 — und kein einziger fälliger + // Wechsel wurde je übernommen, ohne dass es irgendwo als Fehler stand. + if (pathname.startsWith("/api/cron/")) return NextResponse.next(); + const isLoginRoute = pathname.startsWith("/login"); const isSignedIn = Boolean(request.auth?.user?.id);