diff --git a/config/docker/caddy/web-app/Caddyfile b/config/docker/caddy/web-app/Caddyfile index 21b8d5e9..12c7ce4b 100644 --- a/config/docker/caddy/web-app/Caddyfile +++ b/config/docker/caddy/web-app/Caddyfile @@ -24,18 +24,20 @@ header { Access-Control-Allow-Origin "https://app.mo-code.at" Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" - Access-Control-Allow-Headers "Content-Type, Authorization, *" + Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" Access-Control-Allow-Credentials "true" Access-Control-Max-Age "3600" + X-Caddy-CORS "preflight" } - respond 204 + respond "" 204 } header { Access-Control-Allow-Origin "https://app.mo-code.at" Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" - Access-Control-Allow-Headers "Content-Type, Authorization, *" + Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" Access-Control-Allow-Credentials "true" + X-Caddy-CORS "forward" defer } diff --git a/docs/03_Journal/2026-04-23_Plan-B-Formulare.md b/docs/03_Journal/2026-04-23_Plan-B-Formulare.md index 0b3c8ad5..844419b9 100644 --- a/docs/03_Journal/2026-04-23_Plan-B-Formulare.md +++ b/docs/03_Journal/2026-04-23_Plan-B-Formulare.md @@ -92,3 +92,11 @@ Die "Hallo Du!" Test-UI wurde durch produktive, fachlich korrekte Formulare erse - **Problem**: CORS Preflight (OPTIONS) wurde blockiert, vermutlich weil 'defer' Header verzögerte oder 'Access-Control-Allow-Headers' nicht spezifisch genug war. - **Lösung**: Caddyfile umgebaut. OPTIONS-Requests werden nun in einem eigenen Handle mit expliziten Headern (inkl. Content-Type) beantwortet, ohne 'defer'. - **Status**: Versionsmarker auf v2026-04-23.23 aktualisiert. + +### v2026-04-23.24 - CADDY CORS FINAL BOSS +- **Problem**: CORS Preflight (OPTIONS) weiterhin blockiert (v23). Die Fehlermeldung deutete darauf hin, dass die Header immer noch nicht zuverlässig beim Browser ankommen. +- **Lösung**: + - `Caddyfile` radikal gehärtet: `OPTIONS` Requests werden nun mit `X-Caddy-CORS: preflight` markiert und erhalten eine leere Response (`respond "" 204`). + - Hinzufügen von `X-Requested-With` zu den erlaubten Headern (oft von KMP/Ktor-Clients verwendet). + - Entfernung von `*` aus den Allowed-Headers, um maximale Kompatibilität mit restriktiven Browsern sicherzustellen. +- **Status**: Versionsmarker auf v2026-04-23.24 aktualisiert. diff --git a/frontend/shells/meldestelle-web/src/wasmJsMain/kotlin/at/mocode/frontend/shell/web/WebMainScreen.kt b/frontend/shells/meldestelle-web/src/wasmJsMain/kotlin/at/mocode/frontend/shell/web/WebMainScreen.kt index 982c5dbc..b8f393a2 100644 --- a/frontend/shells/meldestelle-web/src/wasmJsMain/kotlin/at/mocode/frontend/shell/web/WebMainScreen.kt +++ b/frontend/shells/meldestelle-web/src/wasmJsMain/kotlin/at/mocode/frontend/shell/web/WebMainScreen.kt @@ -124,7 +124,7 @@ fun MainAppContent() { // Dezentraler Versions-Marker in der unteren rechten Ecke Box(modifier = Modifier.fillMaxSize().padding(8.dp), contentAlignment = Alignment.BottomEnd) { Text( - text = "v2026-04-23.23 - CADDY CORS OPTIONS FIX", + text = "v2026-04-23.24 - CADDY CORS FINAL BOSS", style = MaterialTheme.typography.labelSmall, color = Color.LightGray.copy(alpha = 0.5f) )