meldestelle/config/docker/caddy/web-app/Caddyfile
StefanMoCoAt 277254ebbd
All checks were successful
Build and Publish Docker Images / build-and-push (., backend/services/mail/Dockerfile, mail-service, mail-service) (push) Successful in 5m47s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 3m51s
### fix: verbessere CORS-Handling und UI-Markierungen
- **Caddyfile:** Ersetze `Access-Control-Allow-Origin` durch `*`, entferne `Access-Control-Allow-Credentials`, füge `Access-Control-Expose-Headers` hinzu.
- **GlobalSecurityConfig:** Lockere `allowedOrigins`, `allowedOriginPatterns` und `exposedHeaders` auf `*`, setze `allowCredentials` auf `false`.
- **MailServiceApplication:** Passe CORS-Mapping durch `allowedOrigins` und `allowCredentials` an.
- **UI:** Aktualisiere Versionsmarker auf `v2026-04-23.26 - NUCLEAR CORS v2`.
2026-04-23 14:42:49 +02:00

85 lines
1.9 KiB
Caddyfile

{
auto_https off
metrics
}
:80 {
root * /usr/share/caddy
log {
output stdout
format json
}
header {
Cross-Origin-Embedder-Policy "require-corp"
Cross-Origin-Opener-Policy "same-origin"
}
encode gzip zstd
# CORS-Handshaking direkt im Proxy
# Wir erlauben ALLES für die Domain mo-code.at im Plan-B Modus
handle /api/mail/* {
@options method OPTIONS
handle @options {
header {
Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Headers "*"
Access-Control-Expose-Headers "*"
Access-Control-Max-Age "3600"
X-Caddy-CORS "preflight-v26"
}
respond "" 204
}
header {
Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Headers "*"
Access-Control-Expose-Headers "*"
X-Caddy-CORS "forward-v26"
defer
}
reverse_proxy mail-service:8085
}
handle /health {
respond "healthy" 200
}
# Korrekte MIME für .wasm sicherstellen (Caddy erkennt es i. d. R. automatisch; hier explizit)
@wasm {
path *.wasm
}
header @wasm Content-Type "application/wasm"
# Caching-Strategie: Immutable Assets (hash-Dateien)
# WICHTIG: .wasm und .js werden hier gecached. Falls die Dateinamen gleich bleiben,
# wird der Browser sie NICHT neu laden.
@immutable {
path *.png *.svg *.ico *.woff2 *.map
}
header @immutable Cache-Control "public, max-age=31536000, immutable"
# Wasm und JS Dateien: Kein Cache während der aktiven Entwicklungsphase (Plan-B)
# um "Alte Seite" Probleme zu vermeiden.
@wasm_js {
path *.wasm *.js
}
header @wasm_js Cache-Control "no-store, no-cache, must-revalidate"
# Keine Cache-Header für SPA-Einstieg und Laufzeitkonfig
@nocache {
path /index.html /config.json
}
header @nocache Cache-Control "no-store"
# Static file serving mit SPA-Fallback
handle {
try_files {path} /index.html
file_server
}
}