From fa1253a6754a92b358f4ef3dc97db971e974c816 Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 4 Sep 2023 15:22:17 +0200 Subject: [PATCH] fix(go): set logout cache-control header+add check --- handlers/logout.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/handlers/logout.go b/handlers/logout.go index aa9b567..23f49be 100644 --- a/handlers/logout.go +++ b/handlers/logout.go @@ -21,7 +21,9 @@ func Logout() echo.HandlerFunc { log.Infof("max-age before logout: %d", sess.Options.MaxAge) sess.Options.MaxAge = -1 - if username := sess.Values["username"]; username != nil { + c.Response().Writer.Header().Set("Cache-Control", "no-store") + + if username := sess.Values["username"]; username != nil && username.(string) != "" { sess.Values["username"] = "" }