From a1ba3c00c174fccfb177be067550674b58ddc9a6 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sun, 12 Oct 2025 18:04:57 +0000 Subject: [PATCH] fix: Prevent caching of Docker agent install script and binaries Add no-cache headers to both the install script and agent binary download endpoints to prevent browsers and curl from serving stale cached versions. This ensures users always get the latest install script with URL normalization fixes for trailing slash issues. Fixes #528 --- internal/api/router.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/api/router.go b/internal/api/router.go index 6ad80c3..d462734 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -2566,6 +2566,11 @@ func (r *Router) handleDownloadInstallScript(w http.ResponseWriter, req *http.Re return } + // Prevent caching - always serve the latest version + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + scriptPath := "/opt/pulse/scripts/install-docker-agent.sh" http.ServeFile(w, req, scriptPath) } @@ -2577,6 +2582,11 @@ func (r *Router) handleDownloadAgent(w http.ResponseWriter, req *http.Request) { return } + // Prevent caching - always serve the latest version + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + archParam := strings.TrimSpace(req.URL.Query().Get("arch")) searchPaths := make([]string, 0, 4)