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
This commit is contained in:
rcourtman 2025-10-12 18:04:57 +00:00
parent c18cf3d4b8
commit a1ba3c00c1

View file

@ -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)