Simplify Caddyfile configuration and switch string interpolation to template literals in frontend.
All checks were successful
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 7m31s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 8m8s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 1m58s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 1m43s
All checks were successful
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 7m31s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 8m8s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 1m58s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 1m43s
This commit is contained in:
parent
1afb95c40c
commit
2fd3e39c19
|
|
@ -1,49 +1,35 @@
|
||||||
{
|
{
|
||||||
# TLS wird durch Pangolin/Traefik auf dem VPS terminiert – hier kein HTTPS nötig
|
|
||||||
auto_https off
|
auto_https off
|
||||||
|
|
||||||
servers {
|
servers {
|
||||||
metrics
|
metrics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:4000 {
|
:4000 {
|
||||||
# Root-Verzeichnis für statische Assets
|
|
||||||
root * /usr/share/caddy
|
root * /usr/share/caddy
|
||||||
|
|
||||||
# Logging (strukturiert, JSON)
|
|
||||||
log {
|
log {
|
||||||
output stdout
|
output stdout
|
||||||
format json
|
format json
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sicherheits-Header für SharedArrayBuffer (benötigt für SQLite WASM)
|
|
||||||
header {
|
header {
|
||||||
# Erlaubt das Laden von Cross-Origin-Ressourcen, aber nur wenn diese es explizit erlauben
|
|
||||||
Cross-Origin-Embedder-Policy "require-corp"
|
Cross-Origin-Embedder-Policy "require-corp"
|
||||||
# Isoliert den Kontext, um Sicherheitsrisiken zu minimieren
|
|
||||||
Cross-Origin-Opener-Policy "same-origin"
|
Cross-Origin-Opener-Policy "same-origin"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Komprimierung
|
|
||||||
encode gzip zstd
|
encode gzip zstd
|
||||||
|
|
||||||
# Caddy-Template-Engine: ersetzt {{.Env.VAR}} in index.html UND config.json
|
|
||||||
templates
|
templates
|
||||||
file_server
|
|
||||||
|
|
||||||
# API-Proxy (höchste Priorität – vor dem SPA-Fallback)
|
|
||||||
handle /api/* {
|
handle /api/* {
|
||||||
reverse_proxy api-gateway:8081
|
reverse_proxy api-gateway:8081
|
||||||
}
|
}
|
||||||
|
|
||||||
# Health-Check-Endpunkt (für Pangolin Health-Check konfigurieren: GET /health)
|
|
||||||
handle /health {
|
handle /health {
|
||||||
respond "healthy" 200
|
respond "healthy" 200
|
||||||
}
|
}
|
||||||
|
|
||||||
# SPA-Fallback: existierende Dateien direkt ausliefern, sonst index.html
|
|
||||||
handle {
|
handle {
|
||||||
try_files {path} /index.html
|
try_files {path} /index.html
|
||||||
}
|
file_server
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
// Caddy injiziert: {{.Env.API_BASE_URL}} → z.B. "https://app.mo-code.at"
|
// Caddy injiziert: {{.Env.API_BASE_URL}} → z.B. "https://app.mo-code.at"
|
||||||
const apiFromCaddy = '{{.Env.API_BASE_URL}}';
|
const apiFromCaddy = `{{.Env.API_BASE_URL}}`;
|
||||||
const apiOverride = params.get('apiBaseUrl');
|
const apiOverride = params.get('apiBaseUrl');
|
||||||
globalThis.API_BASE_URL = apiOverride
|
globalThis.API_BASE_URL = apiOverride
|
||||||
? apiOverride.replace(/\/$/, '')
|
? apiOverride.replace(/\/$/, '')
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
: 'http://' + window.location.origin.replace(/\/$/, ''));
|
: 'http://' + window.location.origin.replace(/\/$/, ''));
|
||||||
|
|
||||||
// Caddy injiziert: {{.Env.KEYCLOAK_URL}} → z.B. "https://auth.mo-code.at"
|
// Caddy injiziert: {{.Env.KEYCLOAK_URL}} → z.B. "https://auth.mo-code.at"
|
||||||
const kcFromCaddy = '{{.Env.KEYCLOAK_URL}}';
|
const kcFromCaddy = `{{.Env.KEYCLOAK_URL}}`;
|
||||||
const kcOverride = params.get('keycloakUrl');
|
const kcOverride = params.get('keycloakUrl');
|
||||||
globalThis.KEYCLOAK_URL = kcOverride
|
globalThis.KEYCLOAK_URL = kcOverride
|
||||||
? kcOverride.replace(/\/$/, '')
|
? kcOverride.replace(/\/$/, '')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user