Introduced `config.json` runtime configuration fetch mechanism to support the "Build Once, Deploy Everywhere" pattern. Replaced NGINX with Caddy for SPA deployment, enabling SPA routing, security headers, and static asset management. Updated Gradle and Kotlin/JS build configurations to align with the new runtime environment. Enhanced Dockerfile and health checks for optimized CI/CD workflows and improved SPA delivery.
42 lines
1.0 KiB
Caddyfile
42 lines
1.0 KiB
Caddyfile
:4000 {
|
|
# Root directory for static files
|
|
root * /usr/share/caddy
|
|
|
|
# Enable Gzip/Zstd compression
|
|
encode gzip zstd
|
|
|
|
# Serve static files
|
|
file_server
|
|
|
|
# Templates for runtime configuration (config.json)
|
|
templates {
|
|
mime application/json
|
|
}
|
|
|
|
# SPA Routing: Fallback to index.html for non-existent files
|
|
try_files {path} /index.html
|
|
|
|
# Cache Control for static assets (immutable)
|
|
@static {
|
|
file
|
|
path *.js *.css *.png *.jpg *.svg *.wasm
|
|
}
|
|
header @static Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
# Security Headers (Future Proofing for Wasm)
|
|
header {
|
|
# Cross-Origin Isolation for SharedArrayBuffer (required for some Wasm features)
|
|
Cross-Origin-Opener-Policy "same-origin"
|
|
Cross-Origin-Embedder-Policy "require-corp"
|
|
|
|
# Standard Security Headers
|
|
X-Content-Type-Options "nosniff"
|
|
X-Frame-Options "DENY"
|
|
}
|
|
|
|
# Health Check
|
|
handle /health {
|
|
respond "healthy" 200
|
|
}
|
|
}
|