From 5afc01e3de9b17df98c681acaa92779c44ed9738 Mon Sep 17 00:00:00 2001 From: gammelalf Date: Tue, 24 Jan 2023 12:36:44 +0100 Subject: Bodged missing cookie --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 6d7fc52..ccce08b 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,11 @@ import ( var wrms *Wrms func landingPage(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/static/index.html", 301) + if _, err := r.Cookie("UUID"); err != nil { + http.SetCookie(w, &http.Cookie{Name: "UUID", Value: uuid.NewString(), Path: "/",}) + } + + http.Redirect(w, r, "/static/index.html", http.StatusSeeOther) } func searchHandler(w http.ResponseWriter, r *http.Request) { -- cgit v1.2.3