From 777863a63545d920e2d8021bad33b8f913b8b916 Mon Sep 17 00:00:00 2001 From: Cosmos Admin Date: Sat, 7 Nov 2026 12:19:18 +0530 Subject: [PATCH] fix(cache): replace 1-year immutable cache with no-cache revalidation across all static and console routes --- main.go | 10 +++++++++- oortconsole.go | 4 ++++ orbitcontroller.go | 13 +++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 9281fa8..1762c1e 100644 --- a/main.go +++ b/main.go @@ -674,6 +674,9 @@ func sendPasswordResetEmail(toEmail, token, service string) { // handleForgotPassword handles GET (show form) and POST (send reset email). func handleForgotPassword(w http.ResponseWriter, r *http.Request, service string) { + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") if r.Method == "GET" { w.Header().Set("Content-Type", "text/html; charset=utf-8") data := map[string]any{"Service": service, "Step": "request"} @@ -887,12 +890,17 @@ func main() { mux.HandleFunc("/tailwind.css", func(w http.ResponseWriter, r *http.Request) { data, _ := templatesFS.ReadFile("templates/tailwind.css") w.Header().Set("Content-Type", "text/css; charset=utf-8") + w.Header().Set("Cache-Control", "no-cache, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") w.Write(data) }) mux.HandleFunc("/three.min.js", func(w http.ResponseWriter, r *http.Request) { data, _ := templatesFS.ReadFile("templates/three.min.js") w.Header().Set("Content-Type", "application/javascript; charset=utf-8") - w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") + w.Header().Set("Cache-Control", "no-cache, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") w.Write(data) }) RegisterS3ConsoleRoutes(mux) diff --git a/oortconsole.go b/oortconsole.go index 90f14b3..828e7eb 100644 --- a/oortconsole.go +++ b/oortconsole.go @@ -171,6 +171,10 @@ func handleS3ConsolePage(w http.ResponseWriter, r *http.Request) { }) var username string scyllaSession.Query(`SELECT username FROM cosmos.users WHERE session_id=? ALLOW FILTERING`, sid).Scan(&username) + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + w.Header().Set("Content-Type", "text/html; charset=utf-8") tmpl.ExecuteTemplate(w, "oortconsole.html", map[string]string{"SID": sid, "Username": username}) } diff --git a/orbitcontroller.go b/orbitcontroller.go index 504053d..71f3d85 100644 --- a/orbitcontroller.go +++ b/orbitcontroller.go @@ -545,6 +545,9 @@ func handleOrbitConsole(w http.ResponseWriter, r *http.Request) { return } + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") w.Header().Set("Content-Type", "text/html; charset=utf-8") data := map[string]interface{}{ "UserEmail": email, @@ -1088,7 +1091,10 @@ func handleOrbitProxy(w http.ResponseWriter, r *http.Request, path string) { } if status != "running" { - w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + w.Header().Set("Content-Type", "text/html; charset=utf-8") fmt.Fprintf(w, `

Application is %s

Please start the container from the Orbit console to access it.

Open Orbit Console
`, status) return } @@ -1318,7 +1324,10 @@ func handleOrbitDomainRouteProxy(w http.ResponseWriter, r *http.Request) { } if status != "running" || portNum <= 0 { - w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + w.Header().Set("Content-Type", "text/html; charset=utf-8") fmt.Fprintf(w, `

Application is %s

Start the container from the Orbit console to access it.

Open Orbit Console
`, status) return }