### fix: verbessere CORS-Handling im Caddy-Proxy
All checks were successful
All checks were successful
- **Caddyfile:** Separates Handling für OPTIONS-Requests mit spezifischen Headern eingeführt, `defer` entfernt. - **UI:** Aktualisierung des Versionsmarkers auf `v2026-04-23.23 - CADDY CORS OPTIONS FIX`. - **Docs:** Ergänzung der Analyse und Lösung für Version 23.
This commit is contained in:
parent
03fa74abba
commit
af0ece8ded
|
|
@ -19,18 +19,26 @@
|
|||
|
||||
# Reverse Proxy: Plan-B leitet nur /api/mail an den Mail-Service weiter
|
||||
handle /api/mail/* {
|
||||
@options method OPTIONS
|
||||
handle @options {
|
||||
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-Credentials "true"
|
||||
Access-Control-Max-Age "3600"
|
||||
}
|
||||
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 "*"
|
||||
Access-Control-Allow-Headers "Content-Type, Authorization, *"
|
||||
Access-Control-Allow-Credentials "true"
|
||||
Access-Control-Max-Age "3600"
|
||||
defer
|
||||
}
|
||||
|
||||
@options method OPTIONS
|
||||
respond @options 204
|
||||
|
||||
reverse_proxy mail-service:8085
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,3 +86,9 @@ Die "Hallo Du!" Test-UI wurde durch produktive, fachlich korrekte Formulare erse
|
|||
- Im `Caddyfile` wurde das `defer`-Flag für die Header-Direktive hinzugefügt. Dies stellt sicher, dass Caddy die CORS-Header erst ganz am Ende der Response-Verarbeitung setzt und sie nicht von anderen Direktiven (wie `reverse_proxy`) überschrieben werden können.
|
||||
- Radikale Vereinfachung des CORS-Blocks im Caddyfile für maximale Zuverlässigkeit bei Preflight-Anfragen.
|
||||
- **Status**: Versionsmarker auf v2026-04-23.22 aktualisiert.
|
||||
|
||||
|
||||
### v2026-04-23.23 - CADDY CORS OPTIONS FIX
|
||||
- **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.
|
||||
|
|
|
|||
|
|
@ -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.22 - CADDY DEFER CORS FIX",
|
||||
text = "v2026-04-23.23 - CADDY CORS OPTIONS FIX",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = Color.LightGray.copy(alpha = 0.5f)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user