fix(dev-deploy): explicit Cache-Control on the UI surface #18
@@ -13,6 +13,23 @@
|
|||||||
handle @frontend {
|
handle @frontend {
|
||||||
root * /srv/galaxy-ui
|
root * /srv/galaxy-ui
|
||||||
|
|
||||||
|
# SvelteKit emits hash-named JS/CSS chunks under
|
||||||
|
# `_app/immutable/`; the file name changes whenever the
|
||||||
|
# content changes, so the browser can cache them forever.
|
||||||
|
# Without an explicit Cache-Control, Caddy falls back to
|
||||||
|
# heuristic caching that revalidates on every reload —
|
||||||
|
# measurably slow on Safari + the long-lived dev stack
|
||||||
|
# when the cache is warm. Everything else (index.html
|
||||||
|
# fallback, env.js, version.json, core.wasm,
|
||||||
|
# wasm_exec.js, favicon.svg) must revalidate so a fresh
|
||||||
|
# deploy lands without the user having to clear the
|
||||||
|
# cache by hand.
|
||||||
|
@immutable path /_app/immutable/*
|
||||||
|
header @immutable Cache-Control "public, max-age=31536000, immutable"
|
||||||
|
@dynamic not path /_app/immutable/*
|
||||||
|
header @dynamic Cache-Control "no-cache, must-revalidate"
|
||||||
|
|
||||||
|
try_files {path} /index.html
|
||||||
file_server
|
file_server
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,16 @@
|
|||||||
|
|
||||||
www.galaxy.com {
|
www.galaxy.com {
|
||||||
root * /srv/galaxy-ui
|
root * /srv/galaxy-ui
|
||||||
|
|
||||||
|
# Mirrors the cache policy `Caddyfile.dev` documents in detail:
|
||||||
|
# SvelteKit's hash-named `_app/immutable/*` is safe to cache
|
||||||
|
# forever; everything else must revalidate so a deploy reaches
|
||||||
|
# the browser without a manual cache clear.
|
||||||
|
@immutable path /_app/immutable/*
|
||||||
|
header @immutable Cache-Control "public, max-age=31536000, immutable"
|
||||||
|
@dynamic not path /_app/immutable/*
|
||||||
|
header @dynamic Cache-Control "no-cache, must-revalidate"
|
||||||
|
|
||||||
try_files {path} /index.html
|
try_files {path} /index.html
|
||||||
file_server
|
file_server
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
|
|||||||
Reference in New Issue
Block a user