package web import ( "embed" "net/http" ) // staticFS holds the vendored client assets (htmx) served under /static/. They // are embedded into the binary so a deployed image works without any external // CDN — the UI must not depend on unpkg being reachable from the cluster. // //go:embed static/* var staticFS embed.FS // staticHandler serves the embedded assets with a long cache lifetime. The // files are content-stable (versioned by filename, e.g. htmx.min.js pinned to a // release), so aggressive caching is safe. func staticHandler() http.Handler { fs := http.FileServer(http.FS(staticFS)) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") fs.ServeHTTP(w, r) }) }