diff --git a/internal/router/router.go b/internal/router/router.go index e4eb7093..fca5c84b 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -250,6 +250,21 @@ func RegisterRoutes(cfg *Config) *handlers.Handler { registerWebSocketRoutes(cfg) registerFrontendRoutes(cfg) registerDocumentationRoutes(cfg) + + // Static bundles are served unhashed (reader.js, index.js), so the + // browser must revalidate on every load — with no Cache-Control it + // fell back to heuristic caching and served stale bundles for hours + // after a deploy (user-visible: fixed web bugs "not fixed"). no-cache + // still allows cheap If-Modified-Since 304 revalidation. + e.Pre(func(next echo.HandlerFunc) echo.HandlerFunc { + return func(c *echo.Context) error { + if strings.HasPrefix(c.Request().URL.Path, "/static/") { + c.Response().Header().Set(echo.HeaderCacheControl, "no-cache") + } + return next(c) + } + }) + e.Static("/static", "web/static") // Catch-all 404 handler - must be last