######################################## # Global options ######################################## { email {$CADDY_ACME_EMAIL} # debug } ######################################## # Sendico site definition ######################################## (sendico_site) { vars static_root /usr/share/pweb # Allow overriding upstream via API_UPSTREAM, default to the BFF container. vars api_upstream {$API_UPSTREAM:sendico-bff:8081} encode zstd gzip header { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" } route { ######################################## # Backend API ######################################## handle /api/v1/* { reverse_proxy {vars.api_upstream} { health_uri /api/v1/health health_interval 15s health_timeout 4s health_status 2xx } header Cache-Control "no-cache, no-store, must-revalidate" header Pragma "no-cache" header Expires "0" } ######################################## # Static assets with tailored caching ######################################## handle /version.json { root * {vars.static_root} file_server header Cache-Control "no-cache, no-store, must-revalidate" header Pragma "no-cache" header Expires "0" } handle /*.main.dart.js { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } handle /*.dart.js { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } handle /*.js { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } handle /assets/*.js { root * {vars.static_root} file_server header Cache-Control "public, max-age=31536000, immutable" } handle /assets/*.css { root * {vars.static_root} file_server header Cache-Control "public, max-age=31536000, immutable" } handle /assets/* { root * {vars.static_root} file_server header Cache-Control "public, max-age=31536000, immutable" } handle /canvaskit/* { root * {vars.static_root} file_server header Cache-Control "public, max-age=86400" } handle /icons/* { root * {vars.static_root} file_server header Cache-Control "public, max-age=86400" } handle /*.html { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } handle /*.css { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } handle /*.json { root * {vars.static_root} file_server header Cache-Control "public, max-age=3600" } ######################################## # SPA fallback ######################################## handle { root * {vars.static_root} try_files {path} /index.html file_server header Cache-Control "no-cache, no-store, must-revalidate" header Pragma "no-cache" header Expires "0" } } } ######################################## # Main site ######################################## {$SERVICE_HOST} { import sendico_site }