mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
The management UI is embedded in the binary (//go:embed) and served through http.FileServerFS. Those responses carry no Cache-Control, and the embed FS reports a zero modification time, so there is no Last-Modified or ETag either. Browsers are therefore free to apply heuristic caching and keep an old index.html/app.js/styles.css for hours. That is invisible until the operator upgrades the binary: the new backend then serves requests that the cached old frontend does not know about, so newly added pages never appear (or the UI breaks) until the cache expires or the user hard-refreshes. Set Cache-Control: no-cache on the embedded assets so the browser always revalidates. Revalidation is cheap against a local server, and it makes the UI version follow the binary version, which is the invariant the embed implies. Co-authored-by: WengeLiu101 <233876084+WengeLiu101@users.noreply.github.com>