From 97bf5edc54984dac28aa6649004a3bdc41b04eaf Mon Sep 17 00:00:00 2001 From: Caleb Doxsey Date: Thu, 5 Sep 2024 10:39:50 -0600 Subject: [PATCH] core/ui: no-cache html, force back (#5264) --- ui/embed.go | 3 ++- ui/src/components/SignOutConfirmPage.tsx | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/embed.go b/ui/embed.go index 4162c0d21..6ad8436d8 100644 --- a/ui/embed.go +++ b/ui/embed.go @@ -52,7 +52,8 @@ func ServePage(w http.ResponseWriter, r *http.Request, page, title string, data return err } - http.ServeContent(w, r, "index.html", time.Now(), bytes.NewReader(bs)) + w.Header().Set("Cache-Control", "no-cache, must-revalidate") + http.ServeContent(w, r, "index.html", time.Time{}, bytes.NewReader(bs)) return nil } diff --git a/ui/src/components/SignOutConfirmPage.tsx b/ui/src/components/SignOutConfirmPage.tsx index b7c57a6cf..68474fc6b 100644 --- a/ui/src/components/SignOutConfirmPage.tsx +++ b/ui/src/components/SignOutConfirmPage.tsx @@ -17,7 +17,11 @@ type SignOutConfirmPageProps = { const SignOutConfirmPage: FC = ({ data }) => { function handleClickCancel(evt: React.MouseEvent) { evt.preventDefault(); - history.back(); + if (document.referrer) { + location.href = document.referrer; + } else { + history.back(); + } } function handleClickLogout(evt: React.MouseEvent) {