Serve the built PWA behind your own domain: multi-stage Dockerfile builds dist/ and serves it with Caddy on :80 (TLS terminated at your Cloudflare edge). Caddyfile sets no-cache on sw.js/index/manifest and immutable on hashed assets; SPA fallback to index.html. docker-compose maps :8087. Verified locally: image builds, container serves 200s with correct cache headers and SPA fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
16 lines
446 B
Caddyfile
16 lines
446 B
Caddyfile
:80 {
|
|
root * /srv
|
|
encode gzip zstd
|
|
|
|
# The service worker and entry HTML must never be cached, so PWA updates land.
|
|
@nocache path /sw.js / /index.html /manifest.webmanifest
|
|
header @nocache Cache-Control "no-cache"
|
|
|
|
# Hashed build assets and icons are content-addressed → cache forever.
|
|
@immutable path /assets/* /icons/*
|
|
header @immutable Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
try_files {path} /index.html
|
|
file_server
|
|
}
|