Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: proper cache headers for dashboard assets

Bosche1bfa81125f9
diff --git a/internal/dashboard/dashboard.go b/internal/dashboard/dashboard.go
index 9297a9ea..e00d3e6a 100644
--- a/internal/dashboard/dashboard.go
+++ b/internal/dashboard/dashboard.go
@@ -306,9 +306,9 @@ func (d *Dashboard) RegisterHandlers(mux *http.ServeMux) {
sub, _ := fs.Sub(dashboardFS, "dashboard")
fileServer := http.FileServer(http.FS(sub))
- // Serve static assets under /dashboard/
- mux.Handle("GET /dashboard/assets/", http.StripPrefix("/dashboard", d.withNoCache(fileServer)))
- mux.Handle("GET /dashboard/pinchtab-headed-192.png", http.StripPrefix("/dashboard", d.withNoCache(fileServer)))
+ // Serve static assets under /dashboard/ with long cache (hashed filenames)
+ mux.Handle("GET /dashboard/assets/", http.StripPrefix("/dashboard", d.withLongCache(fileServer)))
+ mux.Handle("GET /dashboard/pinchtab-headed-192.png", http.StripPrefix("/dashboard", d.withLongCache(fileServer)))
// SPA: serve dashboard.html for /dashboard
mux.Handle("GET /dashboard", d.withNoCache(http.HandlerFunc(d.handleDashboardUI)))
@@ -389,6 +389,14 @@ func (d *Dashboard) withNoCache(next http.Handler) http.Handler {
})
}
+func (d *Dashboard) withLongCache(next http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ // Assets have hashes in filenames - cache for 1 year
+ w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
+ next.ServeHTTP(w, r)
+ })
+}
+
type EventObserver func(evt AgentEvent)
func extractAgentID(r *http.Request) string {