meldestelle/config/docker/caddy/web-app/Caddyfile
StefanMoCoAt 23c3e40390
All checks were successful
Build and Publish Docker Images / build-and-push (., backend/services/mail/Dockerfile, mail-service, mail-service) (push) Successful in 5m52s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 4m13s
### fix: 32 erweitere Debug-Logging und Proxy-Strategie
- **NennungRemoteRepository:** API-Logs erweitert (Antwortstatus und Body).
- **Caddyfile:** Strategie-Version auf `v32` aktualisiert.
- **WebMainScreen:** Versionsmarker auf `v2026-04-23.32 - PROXY DEBUG` angepasst.
2026-04-23 16:39:10 +02:00

75 lines
1.8 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
# Same-Origin Strategy: Alle /api/* Anfragen werden intern an den Mail-Service weitergeleitet
# Dadurch sieht der Browser nur noch app.mo-code.at und CORS wird hinfällig.
handle /api/* {
reverse_proxy mail-service:8085 {
header_up Host {upstream_hostport}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
header {
Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Headers "*"
X-Caddy-Strategy "same-origin-v32"
}
}
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
}
}