From 1897175f38ef99d3c06f5e810d371fea53228545 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 19 Jan 2025 00:53:02 -0500 Subject: cmd/anubis: clear the cookie more robustly Signed-off-by: Xe Iaso --- cmd/anubis/main.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd') diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go index b9b907f..cd1a1a6 100644 --- a/cmd/anubis/main.go +++ b/cmd/anubis/main.go @@ -202,6 +202,12 @@ func (s *Server) maybeReverseProxy(w http.ResponseWriter, r *http.Request) { return } + if ckie.Expires.IsZero() { + slog.Debug("cookie has no expiration time", "path", r.URL.Path) + s.renderIndex(w, r) + return + } + slog.Debug("cookie expiration time", "expires", ckie.Expires) if !ckie.Expires.IsZero() && ckie.Expires.Before(time.Now()) { slog.Debug("cookie expired", "path", r.URL.Path) @@ -395,6 +401,7 @@ func clearCookie(w http.ResponseWriter) { Name: cookieName, Value: "", Expires: time.Now().Add(-1 * time.Hour), + MaxAge: -1, }) } -- cgit v1.2.3